a,b = list(map(int,input().split()))

while b != 0:

  a,b = b,a%b

pr = set()

i = 2

while i ** 2 <= a:

  while a % i == 0:

    a //= i

    pr.add(i)

  i += 1

pr.add(a)

pr.add(1)

print((len(pr)))
#16:44

a,b = list(map(int,input().split()))

while b > 0:

  a,b = b,a%b

prime = []

for i in range(2,int(a**.5)+1):

  if a % i == 0:

    p,q = i,0

    while a % i == 0:

      a //= i

      q += 1

    prime.append([p,q])

if a != 1:

  prime.append([a,1])

print((len(prime)+1))
a, b = list(map(int, input().split()))
while b != 0:
    a, b = b, a % b
pr = set()
i = 2
while i**2 <= a:
    while a % i == 0:
        a //= i
        pr.add(i)
    i += 1
pr.add(a)
pr.add(1)
print((len(pr)))

# 16:44
a, b = list(map(int, input().split()))
while b > 0:
    a, b = b, a % b
prime = []
for i in range(2, int(a**0.5) + 1):
    if a % i == 0:
        p, q = i, 0
        while a % i == 0:
            a //= i
            q += 1
        prime.append([p, q])
if a != 1:
    prime.append([a, 1])
print((len(prime) + 1))

+# 16:44 -while b != 0: +while b > 0: -pr = set() -i = 2 -while i**2 <= a: -    while a % i == 0: -        a //= i -        pr.add(i) -    i += 1 -pr.add(a) -pr.add(1) -print((len(pr))) +prime = [] +for i in range(2, int(a**0.5) + 1): +    if a % i == 0: +        p, q = i, 0 +        while a % i == 0: +            a //= i +            q += 1 +        prime.append([p, q]) +if a != 1: +    prime.append([a, 1]) +print((len(prime) + 1))