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



def prime_decompose(x):

    decomposed = []

    for i in range(2,int(pow(x,0.5))+1):

        while x % i == 0:

            x //= i

            decomposed.append(i)

    if x > 1:

        decomposed.append(x)

    return decomposed



A_dec = set(prime_decompose(A))

B_dec = set(prime_decompose(B))



ans = 1

for a in A_dec:

    if a in B_dec:

        ans += 1



print(ans)

import fractions



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



g = fractions.gcd(A, B)



def prime_decompose(x):

    decomposed = []

    for i in range(2,int(pow(x,0.5))+1):

        while x % i == 0:

            x //= i

            decomposed.append(i)

    if x > 1:

        decomposed.append(x)

    return decomposed



g_dec = set(prime_decompose(g))

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


def prime_decompose(x):
    decomposed = []
    for i in range(2, int(pow(x, 0.5)) + 1):
        while x % i == 0:
            x //= i
            decomposed.append(i)
    if x > 1:
        decomposed.append(x)
    return decomposed


A_dec = set(prime_decompose(A))
B_dec = set(prime_decompose(B))
ans = 1
for a in A_dec:
    if a in B_dec:
        ans += 1
print(ans)

import fractions

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


def prime_decompose(x):
    decomposed = []
    for i in range(2, int(pow(x, 0.5)) + 1):
        while x % i == 0:
            x //= i
            decomposed.append(i)
    if x > 1:
        decomposed.append(x)
    return decomposed


g_dec = set(prime_decompose(g))
print((len(g_dec) + 1))

+import fractions + +g = fractions.gcd(A, B) -A_dec = set(prime_decompose(A)) -B_dec = set(prime_decompose(B)) -ans = 1 -for a in A_dec: -    if a in B_dec: -        ans += 1 -print(ans) +g_dec = set(prime_decompose(g)) +print((len(g_dec) + 1))