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

def gcd(A, B):
  if A < B:
    A, B = B, A
  while B > 0:
    temp = A % B
    A = B
    B = temp
  return A

gcd_num = gcd(A, B)

def prime(a):
  max_a = 1 + int(math.sqrt(a))
  d = dict()
  d[1] = 1
  i = 2
  while a != 1:
    if i > max_a:
      d[a] = 1
      break
    if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
  return d
d = prime(gcd_num) 

print(len(d)) import math math A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B def gcd(A, B):
  if A < B:
    A, B = B, A
  while B > 0:
    temp = A % B
    A = B
    B = temp
  return A gcd if A < B:
    A, B = B, A
   A < B A B A, B = B, A A B B A while B > 0:
    temp = A % B
    A = B
    B = temp
   B > 0 B 0 temp = A % B temp A % B A B A = B A B B = temp B temp return A A A A B B gcd_num = gcd(A, B) gcd_num gcd(A, B) gcd A B def prime(a):
  max_a = 1 + int(math.sqrt(a))
  d = dict()
  d[1] = 1
  i = 2
  while a != 1:
    if i > max_a:
      d[a] = 1
      break
    if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
  return d prime max_a = 1 + int(math.sqrt(a)) max_a 1 + int(math.sqrt(a)) 1 int(math.sqrt(a)) int math.sqrt(a) math.sqrt math sqrt a d = dict() d dict() dict d[1] = 1 d[1] d 1 1 i = 2 i 2 while a != 1:
    if i > max_a:
      d[a] = 1
      break
    if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
   a != 1 a 1 if i > max_a:
      d[a] = 1
      break
     i > max_a i max_a d[a] = 1 d[a] d a 1 break if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
   a % i == 0 a % i a i 0 a = a // i a a // i a i if i in d:
        d[i] += 1
      else:
        d[i] = 1
     i in d i d d[i] += 1 d[i] d i 1 d[i] = 1 d[i] d i 1 i += 1 i 1 return d d a a d = prime(gcd_num) d prime(gcd_num) prime gcd_num print(len(d)) print len(d) len d A, B = map(int, input().split()) map(int, input().split()) A def prime(a):
  max_a = 1 + int(math.sqrt(a))
  d = dict()
  d[1] = 1
  i = 2
  while a != 1:
    if i > max_a:
      d[a] = 1
      break
    if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
  return d def prime(a):
  max_a = 1 + int(math.sqrt(a))
  d = dict()
  d[1] = 1
  i = 2
  while a != 1:
    if i > max_a:
      d[a] = 1
      break
    if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
  return d prime gcd_num = gcd(A, B) gcd(A, B) gcd_num B = map(int, input().split()) map(int, input().split()) B d = prime(gcd_num) prime(gcd_num) d def gcd(A, B):
  if A < B:
    A, B = B, A
  while B > 0:
    temp = A % B
    A = B
    B = temp
  return A def gcd(A, B):
  if A < B:
    A, B = B, A
  while B > 0:
    temp = A % B
    A = B
    B = temp
  return A gcd
import math
A, B = map(int, input().split())

def gcd(A, B):
  if A < B:
    A, B = B, A
  while B > 0:
    temp = A % B
    A = B
    B = temp
  return A

gcd_num = gcd(A, B)

def prime(a):
  max_a = 1 + int(math.sqrt(a))
  d = dict()
  d[1] = 1
  i = 2
  while a != 1:
    if i > max_a:
      d[a] = 1
      break
    if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
  return d
d = prime(gcd_num) 

print(len(d))