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





def make_divisors(n):

    divisors = []

    for i in range(1, int(n**0.5)+1):

        if n % i == 0:

            divisors.append(i)

            if i != n // i:

                divisors.append(n//i)



    return divisors



import math



def is_prime(n):

    if n == 1: return True



    for k in range(2, int(math.sqrt(n)) + 1):

        if n % k == 0:

            return False

    return True



import fractions

x = fractions.gcd(A, B)

divisors = make_divisors(x)

ans = 0

for d in divisors:

    if is_prime(d):

        ans += 1

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





def prime_factorize(n):

    a = []

    while n % 2 == 0:

        a.append(2)

        n //= 2

    f = 3

    while f * f <= n:

        if n % f == 0:

            a.append(f)

            n //= f

        else:

            f += 2

    if n != 1:

        a.append(n)

    return a



import fractions

x = fractions.gcd(A, B)

ans = prime_factorize(x)

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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


import math


def is_prime(n):
    if n == 1:
        return True
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True


import fractions

x = fractions.gcd(A, B)
divisors = make_divisors(x)
ans = 0
for d in divisors:
    if is_prime(d):
        ans += 1
print(ans)

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


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


import fractions

x = fractions.gcd(A, B)
ans = prime_factorize(x)
print((len(set(ans)) + 1))

-def make_divisors(n): -    divisors = [] -    for i in range(1, int(n**0.5) + 1): -        if n % i == 0: -            divisors.append(i) -            if i != n // i: -                divisors.append(n // i) -    return divisors - - -import math - - -def is_prime(n): -    if n == 1: -        return True -    for k in range(2, int(math.sqrt(n)) + 1): -        if n % k == 0: -            return False -    return True +def prime_factorize(n): +    a = [] +    while n % 2 == 0: +        a.append(2) +        n //= 2 +    f = 3 +    while f * f <= n: +        if n % f == 0: +            a.append(f) +            n //= f +        else: +            f += 2 +    if n != 1: +        a.append(n) +    return a -divisors = make_divisors(x) -ans = 0 -for d in divisors: -    if is_prime(d): -        ans += 1 -print(ans) +ans = prime_factorize(x) +print((len(set(ans)) + 1))