from collections import defaultdict
from sys import stdin
input = stdin.readline


def prime_fatorization(n):
  # O(sqrt(n))
  # a = []
  a = defaultdict(int)
  while not(n % 2):
    # a.append(2)
    a[2] += 1
    n //= 2
  f = 3
  while f * f <= n:
    if not(n % f):
      # a.append(f)
      a[f] += 1
      n //= f
    else:
      f += 2
  if n != 1:
    # a.append(n)
    a[n] += 1
  return a


def main():
  A, B = list(map(int, input().split()))

  aprime = prime_fatorization(A)
  bprime = prime_fatorization(B)

  aset = set()
  bset = set()

  for ap in aprime.keys():
    aset.add(ap)

  for bp in bprime.keys():
    bset.add(bp)

  print(1+len(aset & bset))


if(__name__ == '__main__'):
  main() from collections import defaultdict from sys import stdin input = stdin.readline input stdin.readline stdin readline def prime_fatorization(n):
  # O(sqrt(n))
  # a = []
  a = defaultdict(int)
  while not(n % 2):
    # a.append(2)
    a[2] += 1
    n //= 2
  f = 3
  while f * f <= n:
    if not(n % f):
      # a.append(f)
      a[f] += 1
      n //= f
    else:
      f += 2
  if n != 1:
    # a.append(n)
    a[n] += 1
  return a prime_fatorization a = defaultdict(int) a defaultdict(int) defaultdict int while not(n % 2):
    # a.append(2)
    a[2] += 1
    n //= 2
   not(n % 2) n % 2 n 2 a[2] += 1 a[2] a 2 1 n //= 2 n 2 f = 3 f 3 while f * f <= n:
    if not(n % f):
      # a.append(f)
      a[f] += 1
      n //= f
    else:
      f += 2
   f * f <= n f * f f f n if not(n % f):
      # a.append(f)
      a[f] += 1
      n //= f
    else:
      f += 2
   not(n % f) n % f n f a[f] += 1 a[f] a f 1 n //= f n f f += 2 f 2 if n != 1:
    # a.append(n)
    a[n] += 1
   n != 1 n 1 a[n] += 1 a[n] a n 1 return a a n n def main():
  A, B = list(map(int, input().split()))

  aprime = prime_fatorization(A)
  bprime = prime_fatorization(B)

  aset = set()
  bset = set()

  for ap in aprime.keys():
    aset.add(ap)

  for bp in bprime.keys():
    bset.add(bp)

  print(1+len(aset & bset)) main A, B = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split B aprime = prime_fatorization(A) aprime prime_fatorization(A) prime_fatorization A bprime = prime_fatorization(B) bprime prime_fatorization(B) prime_fatorization B aset = set() aset set() set bset = set() bset set() set for ap in aprime.keys():
    aset.add(ap)

   ap aprime.keys() aprime.keys aprime keys aset.add(ap) aset.add aset add ap for bp in bprime.keys():
    bset.add(bp)

   bp bprime.keys() bprime.keys bprime keys bset.add(bp) bset.add bset add bp print(1+len(aset & bset)) print 1+len(aset & bset) 1 len(aset & bset) len aset & bset aset bset if(__name__ == '__main__'):
  main() __name__ == '__main__' __name__ '__main__' main() main input = stdin.readline stdin.readline input def prime_fatorization(n):
  # O(sqrt(n))
  # a = []
  a = defaultdict(int)
  while not(n % 2):
    # a.append(2)
    a[2] += 1
    n //= 2
  f = 3
  while f * f <= n:
    if not(n % f):
      # a.append(f)
      a[f] += 1
      n //= f
    else:
      f += 2
  if n != 1:
    # a.append(n)
    a[n] += 1
  return a def prime_fatorization(n):
  # O(sqrt(n))
  # a = []
  a = defaultdict(int)
  while not(n % 2):
    # a.append(2)
    a[2] += 1
    n //= 2
  f = 3
  while f * f <= n:
    if not(n % f):
      # a.append(f)
      a[f] += 1
      n //= f
    else:
      f += 2
  if n != 1:
    # a.append(n)
    a[n] += 1
  return a prime_fatorization def main():
  A, B = list(map(int, input().split()))

  aprime = prime_fatorization(A)
  bprime = prime_fatorization(B)

  aset = set()
  bset = set()

  for ap in aprime.keys():
    aset.add(ap)

  for bp in bprime.keys():
    bset.add(bp)

  print(1+len(aset & bset)) def main():
  A, B = list(map(int, input().split()))

  aprime = prime_fatorization(A)
  bprime = prime_fatorization(B)

  aset = set()
  bset = set()

  for ap in aprime.keys():
    aset.add(ap)

  for bp in bprime.keys():
    bset.add(bp)

  print(1+len(aset & bset)) main
from collections import defaultdict
from sys import stdin
input = stdin.readline


def prime_fatorization(n):
  # O(sqrt(n))
  # a = []
  a = defaultdict(int)
  while not(n % 2):
    # a.append(2)
    a[2] += 1
    n //= 2
  f = 3
  while f * f <= n:
    if not(n % f):
      # a.append(f)
      a[f] += 1
      n //= f
    else:
      f += 2
  if n != 1:
    # a.append(n)
    a[n] += 1
  return a


def main():
  A, B = list(map(int, input().split()))

  aprime = prime_fatorization(A)
  bprime = prime_fatorization(B)

  aset = set()
  bset = set()

  for ap in aprime.keys():
    aset.add(ap)

  for bp in bprime.keys():
    bset.add(bp)

  print(1+len(aset & bset))


if(__name__ == '__main__'):
  main()
