from math import sqrt, ceil



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



c_a = set()

c_b = set()



for i in range(1, ceil(sqrt(a))+1):

  if a % i == 0:

    c_a.add(i)

    if i > 1:

        while a % i == 0:

            a = a // i

if a != 1:

    c_a.add(a)



for j in range(1, ceil(sqrt(b))+1):

  if b % j == 0:

    c_b.add(j)

    if j > 1:

        while b % j == 0:

            b = b // j

if b != 1:

    c_b.add(b)



ans = c_a.intersection(c_b)



print((len(ans)))

from math import sqrt, ceil



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



def gcd(a, b):

  x, y = (a, b) if a > b else (b, a)

  while y > 0:

    x, y = y, x % y

  return x



d = gcd(a, b)

ans = 1

for i in range(2, ceil(sqrt(d))+1):

  if d % i == 0:

    ans += 1

    while(d % i == 0):

      d = d / i

if d != 1:

    ans += 1

print(ans)

from math import sqrt, ceil

a, b = list(map(int, input().split()))
c_a = set()
c_b = set()
for i in range(1, ceil(sqrt(a)) + 1):
    if a % i == 0:
        c_a.add(i)
        if i > 1:
            while a % i == 0:
                a = a // i
if a != 1:
    c_a.add(a)
for j in range(1, ceil(sqrt(b)) + 1):
    if b % j == 0:
        c_b.add(j)
        if j > 1:
            while b % j == 0:
                b = b // j
if b != 1:
    c_b.add(b)
ans = c_a.intersection(c_b)
print((len(ans)))

from math import sqrt, ceil

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


def gcd(a, b):
    x, y = (a, b) if a > b else (b, a)
    while y > 0:
        x, y = y, x % y
    return x


d = gcd(a, b)
ans = 1
for i in range(2, ceil(sqrt(d)) + 1):
    if d % i == 0:
        ans += 1
        while d % i == 0:
            d = d / i
if d != 1:
    ans += 1
print(ans)

-c_a = set() -c_b = set() -for i in range(1, ceil(sqrt(a)) + 1): -    if a % i == 0: -        c_a.add(i) -        if i > 1: -            while a % i == 0: -                a = a // i -if a != 1: -    c_a.add(a) -for j in range(1, ceil(sqrt(b)) + 1): -    if b % j == 0: -        c_b.add(j) -        if j > 1: -            while b % j == 0: -                b = b // j -if b != 1: -    c_b.add(b) -ans = c_a.intersection(c_b) -print((len(ans))) + + +def gcd(a, b): +    x, y = (a, b) if a > b else (b, a) +    while y > 0: +        x, y = y, x % y +    return x + + +d = gcd(a, b) +ans = 1 +for i in range(2, ceil(sqrt(d)) + 1): +    if d % i == 0: +        ans += 1 +        while d % i == 0: +            d = d / i +if d != 1: +    ans += 1 +print(ans)