from fractions import gcd
A, B = map(int, input().split())
g = gcd(A, B)
ans = 1
n = 2
while g > 1:
  if n * n > g:
    ans += 1
    break
  if g % n == 0:
    ans += 1
  while g % n == 0:
    g //= n
  n += 1
print(ans) from fractions import gcd 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 ans = 1 ans 1 n = 2 n 2 while g > 1:
  if n * n > g:
    ans += 1
    break
  if g % n == 0:
    ans += 1
  while g % n == 0:
    g //= n
  n += 1 g > 1 g 1 if n * n > g:
    ans += 1
    break
   n * n > g n * n n n g ans += 1 ans 1 break if g % n == 0:
    ans += 1
   g % n == 0 g % n g n 0 ans += 1 ans 1 while g % n == 0:
    g //= n
   g % n == 0 g % n g n 0 g //= n g n n += 1 n 1 print(ans) print ans B = map(int, input().split()) map(int, input().split()) B g = gcd(A, B) gcd(A, B) g ans = 1 1 ans A, B = map(int, input().split()) map(int, input().split()) A g //= n n g ans += 1 1 ans n = 2 2 n ans += 1 1 ans n += 1 1 n
from fractions import gcd
A, B = map(int, input().split())
g = gcd(A, B)
ans = 1
n = 2
while g > 1:
  if n * n > g:
    ans += 1
    break
  if g % n == 0:
    ans += 1
  while g % n == 0:
    g //= n
  n += 1
print(ans)
