# coding: utf-8



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)

    divisors.sort()

    return divisors



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

dA = make_divisors(A)

dB = make_divisors(B)

Al = list(set(dA) & set(dB))

ans_l = [1]



for i in range(1, len(Al)):

    cnt = 0

    for j in range(i):

        if Al[i] % Al[j] == 0:

            cnt += 1

    if cnt == 1:

        ans_l.append(Al[i])

print((len(set(ans_l))))

# coding: utf-8

from fractions import gcd

def divisor(N):

    # 約数列挙

    divs = []

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

        if N % i == 0:

            divs.append(i)

            if i != N // i:

                divs.append(N//i)

    return divs

def eratosthenes(N):

    # 素数判定

    flag = True

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

        if N % i == 0:

            flag = False

            break

    return flag



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

A_divs = divisor(A)

B_divs = divisor(B)

ans = 1

L = list(set(A_divs) & set(B_divs))

ans = 0

for i in range(len(L)):

    if eratosthenes(L[i]):

        ans += 1

print(ans)
# coding: utf-8
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)
    divisors.sort()
    return divisors


A, B = list(map(int, input().split()))
dA = make_divisors(A)
dB = make_divisors(B)
Al = list(set(dA) & set(dB))
ans_l = [1]
for i in range(1, len(Al)):
    cnt = 0
    for j in range(i):
        if Al[i] % Al[j] == 0:
            cnt += 1
    if cnt == 1:
        ans_l.append(Al[i])
print((len(set(ans_l))))

# coding: utf-8
from fractions import gcd


def divisor(N):
    # 約数列挙
    divs = []
    for i in range(1, int(N**0.5) + 1):
        if N % i == 0:
            divs.append(i)
            if i != N // i:
                divs.append(N // i)
    return divs


def eratosthenes(N):
    # 素数判定
    flag = True
    for i in range(2, int(N**0.5) + 1):
        if N % i == 0:
            flag = False
            break
    return flag


A, B = list(map(int, input().split()))
A_divs = divisor(A)
B_divs = divisor(B)
ans = 1
L = list(set(A_divs) & set(B_divs))
ans = 0
for i in range(len(L)):
    if eratosthenes(L[i]):
        ans += 1
print(ans)

-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) -    divisors.sort() -    return divisors +from fractions import gcd + + +def divisor(N): +    # 約数列挙 +    divs = [] +    for i in range(1, int(N**0.5) + 1): +        if N % i == 0: +            divs.append(i) +            if i != N // i: +                divs.append(N // i) +    return divs + + +def eratosthenes(N): +    # 素数判定 +    flag = True +    for i in range(2, int(N**0.5) + 1): +        if N % i == 0: +            flag = False +            break +    return flag -dA = make_divisors(A) -dB = make_divisors(B) -Al = list(set(dA) & set(dB)) -ans_l = [1] -for i in range(1, len(Al)): -    cnt = 0 -    for j in range(i): -        if Al[i] % Al[j] == 0: -            cnt += 1 -    if cnt == 1: -        ans_l.append(Al[i]) -print((len(set(ans_l)))) +A_divs = divisor(A) +B_divs = divisor(B) +ans = 1 +L = list(set(A_divs) & set(B_divs)) +ans = 0 +for i in range(len(L)): +    if eratosthenes(L[i]): +        ans += 1 +print(ans)