#!/usr/bin/env python3

# input = stdin.readline


def main():
  A,B = map(int,input().split())
  def primeLst(x):
    acc = []
    f = 2
    while f * f <= x:
      if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
    if x != 1:
      acc.append(x)
    return acc
  a = set(primeLst(A))
  b = set(primeLst(B))
  if len(a) * len(b) == 0:
    ans = 1
  else:
    ans = len(a&b) + 1
  print(ans)
  return

if __name__ == '__main__':
  main() def main():
  A,B = map(int,input().split())
  def primeLst(x):
    acc = []
    f = 2
    while f * f <= x:
      if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
    if x != 1:
      acc.append(x)
    return acc
  a = set(primeLst(A))
  b = set(primeLst(B))
  if len(a) * len(b) == 0:
    ans = 1
  else:
    ans = len(a&b) + 1
  print(ans)
  return main A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B def primeLst(x):
    acc = []
    f = 2
    while f * f <= x:
      if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
    if x != 1:
      acc.append(x)
    return acc
   primeLst acc = [] acc [] f = 2 f 2 while f * f <= x:
      if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
     f * f <= x f * f f f x if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
     x % f == 0 x % f x f 0 acc.append(f) acc.append acc append f x //= f x f f += 1 f 1 if x != 1:
      acc.append(x)
     x != 1 x 1 acc.append(x) acc.append acc append x return acc acc x x a = set(primeLst(A)) a set(primeLst(A)) set primeLst(A) primeLst A b = set(primeLst(B)) b set(primeLst(B)) set primeLst(B) primeLst B if len(a) * len(b) == 0:
    ans = 1
  else:
    ans = len(a&b) + 1
   len(a) * len(b) == 0 len(a) * len(b) len(a) len a len(b) len b 0 ans = 1 ans 1 ans = len(a&b) + 1 ans len(a&b) + 1 len(a&b) len a&b a b 1 print(ans) print ans return if __name__ == '__main__':
  main() __name__ == '__main__' __name__ '__main__' main() main def main():
  A,B = map(int,input().split())
  def primeLst(x):
    acc = []
    f = 2
    while f * f <= x:
      if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
    if x != 1:
      acc.append(x)
    return acc
  a = set(primeLst(A))
  b = set(primeLst(B))
  if len(a) * len(b) == 0:
    ans = 1
  else:
    ans = len(a&b) + 1
  print(ans)
  return def main():
  A,B = map(int,input().split())
  def primeLst(x):
    acc = []
    f = 2
    while f * f <= x:
      if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
    if x != 1:
      acc.append(x)
    return acc
  a = set(primeLst(A))
  b = set(primeLst(B))
  if len(a) * len(b) == 0:
    ans = 1
  else:
    ans = len(a&b) + 1
  print(ans)
  return main
#!/usr/bin/env python3

# input = stdin.readline


def main():
  A,B = map(int,input().split())
  def primeLst(x):
    acc = []
    f = 2
    while f * f <= x:
      if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
    if x != 1:
      acc.append(x)
    return acc
  a = set(primeLst(A))
  b = set(primeLst(B))
  if len(a) * len(b) == 0:
    ans = 1
  else:
    ans = len(a&b) + 1
  print(ans)
  return

if __name__ == '__main__':
  main()
