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

def prime_decomposition(x):
  i = 2
  ls = []
  while i * i <= x:
    while x % i == 0:
      x /= i
      ls.append(i)
    i += 1
  if x > 1:
    ls.append(x)
  return ls

cnt = len(set(prime_decomposition(x)))

print(cnt+1) import math math A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B x = math.gcd(A,B) x math.gcd(A,B) math.gcd math gcd A B def prime_decomposition(x):
  i = 2
  ls = []
  while i * i <= x:
    while x % i == 0:
      x /= i
      ls.append(i)
    i += 1
  if x > 1:
    ls.append(x)
  return ls prime_decomposition i = 2 i 2 ls = [] ls [] while i * i <= x:
    while x % i == 0:
      x /= i
      ls.append(i)
    i += 1
   i * i <= x i * i i i x while x % i == 0:
      x /= i
      ls.append(i)
     x % i == 0 x % i x i 0 x /= i x i ls.append(i) ls.append ls append i i += 1 i 1 if x > 1:
    ls.append(x)
   x > 1 x 1 ls.append(x) ls.append ls append x return ls ls x x cnt = len(set(prime_decomposition(x))) cnt len(set(prime_decomposition(x))) len set(prime_decomposition(x)) set prime_decomposition(x) prime_decomposition x print(cnt+1) print cnt+1 cnt 1 cnt = len(set(prime_decomposition(x))) len(set(prime_decomposition(x))) cnt x = math.gcd(A,B) math.gcd(A,B) x def prime_decomposition(x):
  i = 2
  ls = []
  while i * i <= x:
    while x % i == 0:
      x /= i
      ls.append(i)
    i += 1
  if x > 1:
    ls.append(x)
  return ls def prime_decomposition(x):
  i = 2
  ls = []
  while i * i <= x:
    while x % i == 0:
      x /= i
      ls.append(i)
    i += 1
  if x > 1:
    ls.append(x)
  return ls prime_decomposition A,B = map(int,input().split()) map(int,input().split()) A B = map(int,input().split()) map(int,input().split()) B
import math
A,B = map(int,input().split())
x = math.gcd(A,B)

def prime_decomposition(x):
  i = 2
  ls = []
  while i * i <= x:
    while x % i == 0:
      x /= i
      ls.append(i)
    i += 1
  if x > 1:
    ls.append(x)
  return ls

cnt = len(set(prime_decomposition(x)))

print(cnt+1)