from math import gcd

A, B = map(int, input().split())

m = gcd(A, B)
#print(m)

num = int(m**0.5) #mに対する素因数分解は、int(√m)の場合を調べればよい
ans = 1

for i in range(2,num+1):
    if m%i:
        continue
    ans += 1
    while not m%i:
        m /= i

if m>1:
    ans+=1 #m+1が素因数の場合がある

print(ans) from math import gcd A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B m = gcd(A, B) m gcd(A, B) gcd A B num = int(m**0.5) num int(m**0.5) int m**0.5 m 0.5 ans = 1 ans 1 for i in range(2,num+1):
    if m%i:
        continue
    ans += 1
    while not m%i:
        m /= i i range(2,num+1) range 2 num+1 num 1 if m%i:
        continue
     m%i m i continue ans += 1 ans 1 while not m%i:
        m /= i not m%i m%i m i m /= i m i if m>1:
    ans+=1 #m+1が素因数の場合がある m>1 m 1 ans+=1 ans 1 print(ans) print ans B = map(int, input().split()) map(int, input().split()) B num = int(m**0.5) int(m**0.5) num m = gcd(A, B) gcd(A, B) m m /= i i m A, B = map(int, input().split()) map(int, input().split()) A ans = 1 1 ans ans += 1 1 ans ans+=1 1 ans
from math import gcd

A, B = map(int, input().split())

m = gcd(A, B)
#print(m)

num = int(m**0.5) #mに対する素因数分解は、int(√m)の場合を調べればよい
ans = 1

for i in range(2,num+1):
    if m%i:
        continue
    ans += 1
    while not m%i:
        m /= i

if m>1:
    ans+=1 #m+1が素因数の場合がある

print(ans)