import sys



stdin = sys.stdin



ns = lambda : stdin.readline().rstrip()

ni = lambda : int(ns())

na = lambda : list(map(int, stdin.readline().split()))



def divi(n):

  res = []

  for i in range(1, int(n**0.5)+1):

    if n % i == 0:

      res.append(i)

      if i != n // i:

        res.append(n // i)

  return res



def isprime(n):

  if n == 2:

    return True

  if n % 2 == 0 or n < 2:

    return False

  for i in range(3, int(n**0.5)+1, 2):

    if (n % i == 0):

      return False

  return True



def main():

  a, b = sorted(na())

  x = divi(a)

  cnt = 1

  for bb in divi(b):

    if bb in x and isprime(bb):

      cnt += 1

  print(cnt)

main()
def gcd(n, m):

  while m:

    n, m = m, n%m

  return n



def isprime(n):

  if n == 1:

    return False

  for i in range(2, int(n**0.5) + 1):

    if (n % i == 0):

      return False

  return True



def divi(n):

  res = []

  for i in range(1, int(n**0.5)+1):

    if n % i == 0:

      res.append(i)

      if i != n // i:

        res.append(n // i)

  return res



import sys



stdin = sys.stdin



ns = lambda : stdin.readline().rstrip()

ni = lambda : int(ns())

na = lambda : list(map(int, stdin.readline().split()))



def main():

  a, b = na()

  gcd_ = gcd(a, b)

  ans = 1

  for d in divi(gcd_):

    if isprime(d):

      ans += 1

  print(ans)



main()
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))


def divi(n):
    res = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            res.append(i)
            if i != n // i:
                res.append(n // i)
    return res


def isprime(n):
    if n == 2:
        return True
    if n % 2 == 0 or n < 2:
        return False
    for i in range(3, int(n**0.5) + 1, 2):
        if n % i == 0:
            return False
    return True


def main():
    a, b = sorted(na())
    x = divi(a)
    cnt = 1
    for bb in divi(b):
        if bb in x and isprime(bb):
            cnt += 1
    print(cnt)


main()

def gcd(n, m):
    while m:
        n, m = m, n % m
    return n


def isprime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False
    return True


def divi(n):
    res = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            res.append(i)
            if i != n // i:
                res.append(n // i)
    return res


import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))


def main():
    a, b = na()
    gcd_ = gcd(a, b)
    ans = 1
    for d in divi(gcd_):
        if isprime(d):
            ans += 1
    print(ans)


main()

-import sys +def gcd(n, m): +    while m: +        n, m = m, n % m +    return n -stdin = sys.stdin -ns = lambda: stdin.readline().rstrip() -ni = lambda: int(ns()) -na = lambda: list(map(int, stdin.readline().split())) + +def isprime(n): +    if n == 1: +        return False +    for i in range(2, int(n**0.5) + 1): +        if n % i == 0: +            return False +    return True -def isprime(n): -    if n == 2: -        return True -    if n % 2 == 0 or n < 2: -        return False -    for i in range(3, int(n**0.5) + 1, 2): -        if n % i == 0: -            return False -    return True +import sys + +stdin = sys.stdin +ns = lambda: stdin.readline().rstrip() +ni = lambda: int(ns()) +na = lambda: list(map(int, stdin.readline().split())) -    a, b = sorted(na()) -    x = divi(a) -    cnt = 1 -    for bb in divi(b): -        if bb in x and isprime(bb): -            cnt += 1 -    print(cnt) +    a, b = na() +    gcd_ = gcd(a, b) +    ans = 1 +    for d in divi(gcd_): +        if isprime(d): +            ans += 1 +    print(ans)