import fractions



def factor(x):

  t = x

  p = [1]

  for i in range(2, -int(-x**0.5//1)+1):

    if x % i == 0:

      p += [i]

      while x % i == 0:

        x /= i

  if x != 1:

    p += [x]

  if len(p) == 1 and t != 1:

    p += [t]

  return p



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

d = fractions.gcd(A, B)

p = factor(d)

print((len(p)))

#p = factorization(d)

#print(p)

#print(len(p) + (0 if p[0][0] == 1 else 1))

import fractions



def factor(x):

  t = x

  p = [1]

  for i in range(2, -int(-x**0.5//1)+1):

    if x % i == 0:

      p.append(i)

      while x % i == 0:

        x /= i

  if x != 1:

    p.append(x)

  if len(p) == 1 and t != 1:

    p.append(t)

  return p



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

d = fractions.gcd(A, B)

p = factor(d)

print((len(p)))

#p = factorization(d)

#print(p)

#print(len(p) + (0 if p[0][0] == 1 else 1))

import fractions


def factor(x):
    t = x
    p = [1]
    for i in range(2, -int(-(x**0.5) // 1) + 1):
        if x % i == 0:
            p += [i]
            while x % i == 0:
                x /= i
    if x != 1:
        p += [x]
    if len(p) == 1 and t != 1:
        p += [t]
    return p


A, B = list(map(int, input().split()))
d = fractions.gcd(A, B)
p = factor(d)
print((len(p)))
# p = factorization(d)
# print(p)
# print(len(p) + (0 if p[0][0] == 1 else 1))

import fractions


def factor(x):
    t = x
    p = [1]
    for i in range(2, -int(-(x**0.5) // 1) + 1):
        if x % i == 0:
            p.append(i)
            while x % i == 0:
                x /= i
    if x != 1:
        p.append(x)
    if len(p) == 1 and t != 1:
        p.append(t)
    return p


A, B = list(map(int, input().split()))
d = fractions.gcd(A, B)
p = factor(d)
print((len(p)))
# p = factorization(d)
# print(p)
# print(len(p) + (0 if p[0][0] == 1 else 1))

-            p += [i] +            p.append(i) -        p += [x] +        p.append(x) -        p += [t] +        p.append(t)