import fractions



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



x = fractions.gcd(a,b)

ans = []



i = 2

y = int(x**0.5)

for j in range(10000000):

    if x%i == 0:

        x //= i

        ans.append(i)

        i = 2

        y = int(x**0.5)

    elif i == y:

        ans.append(x)

        break

    else:

        i += 1



print((len(set(ans))+1))
import fractions



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



x = fractions.gcd(a,b)

ans = []



i = 2

y = int(x**0.5)

while True:

    if x%i == 0:

        x //= i

        ans.append(i)

    elif i == y:

        ans.append(x)

        break

    elif x == 1:

        break

    else:

        i += 1



print((len(set(ans))+1))
import fractions

a, b = list(map(int, input().split()))
x = fractions.gcd(a, b)
ans = []
i = 2
y = int(x**0.5)
for j in range(10000000):
    if x % i == 0:
        x //= i
        ans.append(i)
        i = 2
        y = int(x**0.5)
    elif i == y:
        ans.append(x)
        break
    else:
        i += 1
print((len(set(ans)) + 1))

import fractions

a, b = list(map(int, input().split()))
x = fractions.gcd(a, b)
ans = []
i = 2
y = int(x**0.5)
while True:
    if x % i == 0:
        x //= i
        ans.append(i)
    elif i == y:
        ans.append(x)
        break
    elif x == 1:
        break
    else:
        i += 1
print((len(set(ans)) + 1))

-for j in range(10000000): +while True: -        i = 2 -        y = int(x**0.5) +        break +    elif x == 1: