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
  k=int(n**0.5)+1
  for j in range(i,k+1,2):
    if n%j==0:
      n//=j
      prime.append(j)
      while n%j==0:
        n//=j
  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
  k=int(n**0.5)+1
  for j in range(i,k+1,2):
    if n%j==0:
      n//=j
      prime.append(j)
      while n%j==0:
        n//=j
  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 k=int(n**0.5)+1 k int(n**0.5)+1 int(n**0.5) int n**0.5 n 0.5 1 for j in range(i,k+1,2):
    if n%j==0:
      n//=j
      prime.append(j)
      while n%j==0:
        n//=j
   j range(i,k+1,2) range i k+1 k 1 2 if n%j==0:
      n//=j
      prime.append(j)
      while n%j==0:
        n//=j
   n%j==0 n%j n j 0 n//=j n j prime.append(j) prime.append prime append j while n%j==0:
        n//=j
   n%j==0 n%j n j 0 n//=j n j 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
  k=int(n**0.5)+1
  for j in range(i,k+1,2):
    if n%j==0:
      n//=j
      prime.append(j)
      while n%j==0:
        n//=j
  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
  k=int(n**0.5)+1
  for j in range(i,k+1,2):
    if n%j==0:
      n//=j
      prime.append(j)
      while n%j==0:
        n//=j
  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
  k=int(n**0.5)+1
  for j in range(i,k+1,2):
    if n%j==0:
      n//=j
      prime.append(j)
      while n%j==0:
        n//=j
  if n>1:
    prime.append(n)
  return prime

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