import math
n,m=map(int,input().split())
gcd=math.gcd(m,n)
i=1
ans=[]
max=int(math.sqrt(gcd))
for i in range(2,max+2):
    while gcd%i==0:
        ans.append(i)
        gcd//=i
if gcd>1:
  ans.append(n)

print(len(set(ans))+1) import math math n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m gcd=math.gcd(m,n) gcd math.gcd(m,n) math.gcd math gcd m n i=1 i 1 ans=[] ans [] max=int(math.sqrt(gcd)) max int(math.sqrt(gcd)) int math.sqrt(gcd) math.sqrt math sqrt gcd for i in range(2,max+2):
    while gcd%i==0:
        ans.append(i)
        gcd//=i i range(2,max+2) range 2 max+2 max 2 while gcd%i==0:
        ans.append(i)
        gcd//=i gcd%i==0 gcd%i gcd i 0 ans.append(i) ans.append ans append i gcd//=i gcd i if gcd>1:
  ans.append(n) gcd>1 gcd 1 ans.append(n) ans.append ans append n print(len(set(ans))+1) print len(set(ans))+1 len(set(ans)) len set(ans) set ans 1 gcd=math.gcd(m,n) math.gcd(m,n) gcd max=int(math.sqrt(gcd)) int(math.sqrt(gcd)) max m=map(int,input().split()) map(int,input().split()) m n,m=map(int,input().split()) map(int,input().split()) n i=1 1 i ans=[] [] ans gcd//=i i gcd
import math
n,m=map(int,input().split())
gcd=math.gcd(m,n)
i=1
ans=[]
max=int(math.sqrt(gcd))
for i in range(2,max+2):
    while gcd%i==0:
        ans.append(i)
        gcd//=i
if gcd>1:
  ans.append(n)

print(len(set(ans))+1)