def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
P = [1 for _ in range(10**6)]
P[0]=0
P[1]=0
for i in range(2,10**3):
    for j in range(i*i,10**6,i):
        P[j] = 0
Q = []
for i in range(2,10**6):
    if P[i]==1:
        Q.append(i)
A,B = map(int,input().split())
N = gcd(A,B)
R = [1]
for p in Q:
    if N%p==0:
        R.append(p)
        while N%p==0:
            N = N//p
if N>1:
    R.append(N)
print(len(R)) def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x gcd while y>0:
        x,y = y,x%y
     y>0 y 0 x,y = y,x%y x y y x%y x y return x x x x y y 1 for _ in range(10**6) for _ in range(10**6) _ range(10**6) range 10**6 10 6 for _ in range(10**6) 1 P = [1 for _ in range(10**6)] P [1 for _ in range(10**6)] P[0]=0 P[0] P 0 0 P[1]=0 P[1] P 1 0 for i in range(2,10**3):
    for j in range(i*i,10**6,i):
        P[j] = 0 i range(2,10**3) range 2 10**3 10 3 for j in range(i*i,10**6,i):
        P[j] = 0 j range(i*i,10**6,i) range i*i i i 10**6 10 6 i P[j] = 0 P[j] P j 0 Q = [] Q [] for i in range(2,10**6):
    if P[i]==1:
        Q.append(i) i range(2,10**6) range 2 10**6 10 6 if P[i]==1:
        Q.append(i) P[i]==1 P[i] P i 1 Q.append(i) Q.append Q append i A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B N = gcd(A,B) N gcd(A,B) gcd A B R = [1] R [1] 1 for p in Q:
    if N%p==0:
        R.append(p)
        while N%p==0:
            N = N//p p Q if N%p==0:
        R.append(p)
        while N%p==0:
            N = N//p N%p==0 N%p N p 0 R.append(p) R.append R append p while N%p==0:
            N = N//p N%p==0 N%p N p 0 N = N//p N N//p N p if N>1:
    R.append(N) N>1 N 1 R.append(N) R.append R append N print(len(R)) print len(R) len R def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x gcd R = [1] [1] R N = gcd(A,B) gcd(A,B) N N = N//p N//p N Q = [] [] Q P = [1 for _ in range(10**6)] [1 for _ in range(10**6)] P B = map(int,input().split()) map(int,input().split()) B A,B = map(int,input().split()) map(int,input().split()) A
def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x
P = [1 for _ in range(10**6)]
P[0]=0
P[1]=0
for i in range(2,10**3):
    for j in range(i*i,10**6,i):
        P[j] = 0
Q = []
for i in range(2,10**6):
    if P[i]==1:
        Q.append(i)
A,B = map(int,input().split())
N = gcd(A,B)
R = [1]
for p in Q:
    if N%p==0:
        R.append(p)
        while N%p==0:
            N = N//p
if N>1:
    R.append(N)
print(len(R))