from functools import lru_cache





@lru_cache(maxsize=None)

def get_dividers(n):

    """

    正の整数 n の約数を取得する

    """



    dividers = {i for i in range(1, int(n ** 0.5) + 1) if n % i == 0}

    return dividers | {n // d for d in dividers}





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



a_dividers = get_dividers(A)

b_dividers = get_dividers(B)

common_dividers = a_dividers & b_dividers

ans = []



for cd in sorted(common_dividers):

    dividers = get_dividers(cd) - {1}

    for d in ans:

        if d & dividers:

            break

    else:

        ans.append(dividers)



print((len(ans)))

from functools import lru_cache





@lru_cache(maxsize=None)

def prime_factorization(n):

    """

    nを素因数分解して素因数のリストを返却する

    """

    primes = []

    while n % 2 == 0:

        primes.append(2)

        n //= 2

    i = 3

    while i ** 2 <= n:

        while n % i == 0:

            primes.append(i)

            n //= i

        i += 2

    if n != 1:

        primes.append(n)

    return primes





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



a_primes = set(prime_factorization(A))

b_primes = set(prime_factorization(B))



print((len(a_primes & b_primes) + 1))

from functools import lru_cache


@lru_cache(maxsize=None)
def get_dividers(n):
    """
    正の整数 n の約数を取得する
    """
    dividers = {i for i in range(1, int(n**0.5) + 1) if n % i == 0}
    return dividers | {n // d for d in dividers}


A, B = list(map(int, input().split(" ")))
a_dividers = get_dividers(A)
b_dividers = get_dividers(B)
common_dividers = a_dividers & b_dividers
ans = []
for cd in sorted(common_dividers):
    dividers = get_dividers(cd) - {1}
    for d in ans:
        if d & dividers:
            break
    else:
        ans.append(dividers)
print((len(ans)))

from functools import lru_cache


@lru_cache(maxsize=None)
def prime_factorization(n):
    """
    nを素因数分解して素因数のリストを返却する
    """
    primes = []
    while n % 2 == 0:
        primes.append(2)
        n //= 2
    i = 3
    while i**2 <= n:
        while n % i == 0:
            primes.append(i)
            n //= i
        i += 2
    if n != 1:
        primes.append(n)
    return primes


A, B = list(map(int, input().split(" ")))
a_primes = set(prime_factorization(A))
b_primes = set(prime_factorization(B))
print((len(a_primes & b_primes) + 1))

-def get_dividers(n): +def prime_factorization(n): -    正の整数 n の約数を取得する +    nを素因数分解して素因数のリストを返却する -    dividers = {i for i in range(1, int(n**0.5) + 1) if n % i == 0} -    return dividers | {n // d for d in dividers} +    primes = [] +    while n % 2 == 0: +        primes.append(2) +        n //= 2 +    i = 3 +    while i**2 <= n: +        while n % i == 0: +            primes.append(i) +            n //= i +        i += 2 +    if n != 1: +        primes.append(n) +    return primes -a_dividers = get_dividers(A) -b_dividers = get_dividers(B) -common_dividers = a_dividers & b_dividers -ans = [] -for cd in sorted(common_dividers): -    dividers = get_dividers(cd) - {1} -    for d in ans: -        if d & dividers: -            break -    else: -        ans.append(dividers) -print((len(ans))) +a_primes = set(prime_factorization(A)) +b_primes = set(prime_factorization(B)) +print((len(a_primes & b_primes) + 1))