def gcd(a,b):
  while b:
    a,b=b,a%b
  return a
a,b=map(int,input().split())
g=gcd(a,b)

c=1
for i in range(2,10**6+1):
  if g%i==0:
    c+=1
    while g%i==0:
      g//=i
if g!=1:
  c+=1
print(c) def gcd(a,b):
  while b:
    a,b=b,a%b
  return a gcd while b:
    a,b=b,a%b
   b a,b=b,a%b a b b a%b a b return a a a a b b a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b g=gcd(a,b) g gcd(a,b) gcd a b c=1 c 1 for i in range(2,10**6+1):
  if g%i==0:
    c+=1
    while g%i==0:
      g//=i i range(2,10**6+1) range 2 10**6+1 10**6 10 6 1 if g%i==0:
    c+=1
    while g%i==0:
      g//=i g%i==0 g%i g i 0 c+=1 c 1 while g%i==0:
      g//=i g%i==0 g%i g i 0 g//=i g i if g!=1:
  c+=1 g!=1 g 1 c+=1 c 1 print(c) print c c+=1 1 c a,b=map(int,input().split()) map(int,input().split()) a c=1 1 c g//=i i g c+=1 1 c def gcd(a,b):
  while b:
    a,b=b,a%b
  return a def gcd(a,b):
  while b:
    a,b=b,a%b
  return a gcd g=gcd(a,b) gcd(a,b) g b=map(int,input().split()) map(int,input().split()) b
def gcd(a,b):
  while b:
    a,b=b,a%b
  return a
a,b=map(int,input().split())
g=gcd(a,b)

c=1
for i in range(2,10**6+1):
  if g%i==0:
    c+=1
    while g%i==0:
      g//=i
if g!=1:
  c+=1
print(c)