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

ans = 1

for i in range(2, 1+int(min(A**.5, B**.5))):

    if A % i == 0 and B % i == 0:

        ans += 1

    while A % i == 0:

        A //= i

    while B % i == 0:

        B //= i

if A != 1 and B != 1 and (A % B == 0 or B % A == 0):

    ans += 1

print(ans)

from fractions import gcd



def prime_factor(n):

    factors = set()

    i = 2

    while i * i <= n:

        while n % i == 0:

            factors.add(i)

            n //= i

        i += 1

    if n != 1:

        factors.add(n)

    return factors



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

print((len(prime_factor(gcd(A, B))) + 1))
A, B = list(map(int, input().split()))
ans = 1
for i in range(2, 1 + int(min(A**0.5, B**0.5))):
    if A % i == 0 and B % i == 0:
        ans += 1
    while A % i == 0:
        A //= i
    while B % i == 0:
        B //= i
if A != 1 and B != 1 and (A % B == 0 or B % A == 0):
    ans += 1
print(ans)

from fractions import gcd


def prime_factor(n):
    factors = set()
    i = 2
    while i * i <= n:
        while n % i == 0:
            factors.add(i)
            n //= i
        i += 1
    if n != 1:
        factors.add(n)
    return factors


A, B = list(map(int, input().split()))
print((len(prime_factor(gcd(A, B))) + 1))

+from fractions import gcd + + +def prime_factor(n): +    factors = set() +    i = 2 +    while i * i <= n: +        while n % i == 0: +            factors.add(i) +            n //= i +        i += 1 +    if n != 1: +        factors.add(n) +    return factors + + -ans = 1 -for i in range(2, 1 + int(min(A**0.5, B**0.5))): -    if A % i == 0 and B % i == 0: -        ans += 1 -    while A % i == 0: -        A //= i -    while B % i == 0: -        B //= i -if A != 1 and B != 1 and (A % B == 0 or B % A == 0): -    ans += 1 -print(ans) +print((len(prime_factor(gcd(A, B))) + 1))