import fractions



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



g = fractions.gcd(A, B)

d = []

p = []



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

    if g % i == 0:

        d.append(i)

        if i != g//i:

           d.append(g//i)



for i in d:

    s = 0

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

        if i % j == 0:

            s += 1



    if s == 1:

        p.append(i)



print((len(p)))

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)
d = []
p = []
for i in range(1, int(pow(g, 0.5)) + 1):
    if g % i == 0:
        d.append(i)
        if i != g // i:
            d.append(g // i)
for i in d:
    s = 0
    for j in range(1, int(pow(i, 0.5)) + 1):
        if i % j == 0:
            s += 1
    if s == 1:
        p.append(i)
print((len(p)))

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())) -A, B = list(map(int, input().split())) -g = fractions.gcd(A, B) -d = [] -p = [] -for i in range(1, int(pow(g, 0.5)) + 1): -    if g % i == 0: -        d.append(i) -        if i != g // i: -            d.append(g // i) -for i in d: -    s = 0 -    for j in range(1, int(pow(i, 0.5)) + 1): -        if i % j == 0: -            s += 1 -    if s == 1: -        p.append(i) -print((len(p))) + +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)