import math
a,b=map(int,input().split())
gcd=math.gcd(a,b)

def prime_factorization(n):
  i=2
  prime=[]
  if n%i==0:
    n//=i
    prime.append(2)
    while n%i==0:
      n//=i
  i+=1
  while i*i<=n:
    if n%i:
      i+=2
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
  if n>1:
    prime.append(n)
  return prime

print(len(prime_factorization(gcd))+1) import math math a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b gcd=math.gcd(a,b) gcd math.gcd(a,b) math.gcd math gcd a b def prime_factorization(n):
  i=2
  prime=[]
  if n%i==0:
    n//=i
    prime.append(2)
    while n%i==0:
      n//=i
  i+=1
  while i*i<=n:
    if n%i:
      i+=2
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
  if n>1:
    prime.append(n)
  return prime prime_factorization i=2 i 2 prime=[] prime [] if n%i==0:
    n//=i
    prime.append(2)
    while n%i==0:
      n//=i
   n%i==0 n%i n i 0 n//=i n i prime.append(2) prime.append prime append 2 while n%i==0:
      n//=i
   n%i==0 n%i n i 0 n//=i n i i+=1 i 1 while i*i<=n:
    if n%i:
      i+=2
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
   i*i<=n i*i i i n if n%i:
      i+=2
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
   n%i n i i+=2 i 2 n//=i n i prime.append(i) prime.append prime append i while n%i==0:
        n//=i
   n%i==0 n%i n i 0 n//=i n i if n>1:
    prime.append(n)
   n>1 n 1 prime.append(n) prime.append prime append n return prime prime n n print(len(prime_factorization(gcd))+1) print len(prime_factorization(gcd))+1 len(prime_factorization(gcd)) len prime_factorization(gcd) prime_factorization gcd 1 a,b=map(int,input().split()) map(int,input().split()) a gcd=math.gcd(a,b) math.gcd(a,b) gcd b=map(int,input().split()) map(int,input().split()) b def prime_factorization(n):
  i=2
  prime=[]
  if n%i==0:
    n//=i
    prime.append(2)
    while n%i==0:
      n//=i
  i+=1
  while i*i<=n:
    if n%i:
      i+=2
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
  if n>1:
    prime.append(n)
  return prime def prime_factorization(n):
  i=2
  prime=[]
  if n%i==0:
    n//=i
    prime.append(2)
    while n%i==0:
      n//=i
  i+=1
  while i*i<=n:
    if n%i:
      i+=2
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
  if n>1:
    prime.append(n)
  return prime prime_factorization
import math
a,b=map(int,input().split())
gcd=math.gcd(a,b)

def prime_factorization(n):
  i=2
  prime=[]
  if n%i==0:
    n//=i
    prime.append(2)
    while n%i==0:
      n//=i
  i+=1
  while i*i<=n:
    if n%i:
      i+=2
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
  if n>1:
    prime.append(n)
  return prime

print(len(prime_factorization(gcd))+1)