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





def prime_decomposition(n):

    i = 2

    table = []

    while i * i <= n:

        while n % i == 0:

            n /= i

            table.append(i)

        i += 1

    if n > 1:

        table.append(n)

    return table





a = set(prime_decomposition(A))

b = set(prime_decomposition(B))



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





def gcd(a, b):

    while b:

        a, b = b, a % b

    return a





def prime_decomposition(n):

    i = 2

    table = []

    while i * i <= n:

        while n % i == 0:

            n /= i

            table.append(i)

        i += 1

    if n > 1:

        table.append(n)

    return table





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


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


a = set(prime_decomposition(A))
b = set(prime_decomposition(B))
print((len(a & b) + 1))

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


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


print((len(set(prime_decomposition(gcd(A, B)))) + 1))

+ + +def gcd(a, b): +    while b: +        a, b = b, a % b +    return a -a = set(prime_decomposition(A)) -b = set(prime_decomposition(B)) -print((len(a & b) + 1)) +print((len(set(prime_decomposition(gcd(A, B)))) + 1))