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



def getPrimeFactors(x):

    ans = []

    for d in range(2, int(x**0.5)+1):

        while x%d == 0:

            ans.append(d)

            x //= d

    if x != 1:

        ans.append(x)

    return ans



pfAs = [1] + getPrimeFactors(A)

pfBs = [1] + getPrimeFactors(B)



ans = len(set(pfAs) & set(pfBs))

print(ans)

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



def getPrimeFactors(x):

    anss = []

    while x%2 == 0:

        anss.append(2)

        x //= 2

    for d in range(3, int(x**0.5)+1, 2):

        while x%d == 0:

            anss.append(d)

            x //= d

    if x != 1:

        anss.append(x)

    return anss



PFAs = getPrimeFactors(A) + [1]

PFBs = getPrimeFactors(B) + [1]



setA = set(PFAs)

setB = set(PFBs)



ans = len(setA & setB)



print(ans)

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


def getPrimeFactors(x):
    ans = []
    for d in range(2, int(x**0.5) + 1):
        while x % d == 0:
            ans.append(d)
            x //= d
    if x != 1:
        ans.append(x)
    return ans


pfAs = [1] + getPrimeFactors(A)
pfBs = [1] + getPrimeFactors(B)
ans = len(set(pfAs) & set(pfBs))
print(ans)

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


def getPrimeFactors(x):
    anss = []
    while x % 2 == 0:
        anss.append(2)
        x //= 2
    for d in range(3, int(x**0.5) + 1, 2):
        while x % d == 0:
            anss.append(d)
            x //= d
    if x != 1:
        anss.append(x)
    return anss


PFAs = getPrimeFactors(A) + [1]
PFBs = getPrimeFactors(B) + [1]
setA = set(PFAs)
setB = set(PFBs)
ans = len(setA & setB)
print(ans)

-    ans = [] -    for d in range(2, int(x**0.5) + 1): +    anss = [] +    while x % 2 == 0: +        anss.append(2) +        x //= 2 +    for d in range(3, int(x**0.5) + 1, 2): -            ans.append(d) +            anss.append(d) -        ans.append(x) -    return ans +        anss.append(x) +    return anss -pfAs = [1] + getPrimeFactors(A) -pfBs = [1] + getPrimeFactors(B) -ans = len(set(pfAs) & set(pfBs)) +PFAs = getPrimeFactors(A) + [1] +PFBs = getPrimeFactors(B) + [1] +setA = set(PFAs) +setB = set(PFBs) +ans = len(setA & setB)