def gcd(a, b):
    if a<b:
        a,b = b,a
    r = a%b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b

a,b = list(map(int,input().split()))
c = gcd(a,b)
c0 = c
r = 2
lis = [1]
count = 1
while c != 1:
    if c%r == 0:
        c = c//r
        lis.append(r)
        r = 2
    else:
        r += 1
    if r > int(pow(c0,0.5))+1:
        lis.append(c)
        break
d = list(set(lis))
print(len(d)) def gcd(a, b):
    if a<b:
        a,b = b,a
    r = a%b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b gcd if a<b:
        a,b = b,a
     a<b a b a,b = b,a a b b a r = a%b r a%b a b while r != 0:
        a = b
        b = r
        r = a % b
     r != 0 r 0 a = b a b b = r b r r = a % b r a % b a b return b b a a b b a,b = list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split b c = gcd(a,b) c gcd(a,b) gcd a b c0 = c c0 c r = 2 r 2 lis = [1] lis [1] 1 count = 1 count 1 while c != 1:
    if c%r == 0:
        c = c//r
        lis.append(r)
        r = 2
    else:
        r += 1
    if r > int(pow(c0,0.5))+1:
        lis.append(c)
        break c != 1 c 1 if c%r == 0:
        c = c//r
        lis.append(r)
        r = 2
    else:
        r += 1
     c%r == 0 c%r c r 0 c = c//r c c//r c r lis.append(r) lis.append lis append r r = 2 r 2 r += 1 r 1 if r > int(pow(c0,0.5))+1:
        lis.append(c)
        break r > int(pow(c0,0.5))+1 r int(pow(c0,0.5))+1 int(pow(c0,0.5)) int pow(c0,0.5) pow c0 0.5 1 lis.append(c) lis.append lis append c break d = list(set(lis)) d list(set(lis)) list set(lis) set lis print(len(d)) print len(d) len d count = 1 1 count def gcd(a, b):
    if a<b:
        a,b = b,a
    r = a%b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b def gcd(a, b):
    if a<b:
        a,b = b,a
    r = a%b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b gcd lis = [1] [1] lis r = 2 2 r d = list(set(lis)) list(set(lis)) d b = list(map(int,input().split())) list(map(int,input().split())) b c = c//r c//r c c = gcd(a,b) gcd(a,b) c r = 2 2 r a,b = list(map(int,input().split())) list(map(int,input().split())) a r += 1 1 r c0 = c c c0
def gcd(a, b):
    if a<b:
        a,b = b,a
    r = a%b
    while r != 0:
        a = b
        b = r
        r = a % b
    return b

a,b = list(map(int,input().split()))
c = gcd(a,b)
c0 = c
r = 2
lis = [1]
count = 1
while c != 1:
    if c%r == 0:
        c = c//r
        lis.append(r)
        r = 2
    else:
        r += 1
    if r > int(pow(c0,0.5))+1:
        lis.append(c)
        break
d = list(set(lis))
print(len(d))