from math import sqrt





def IsPrime(num):

    if num < 2:

        return True

    elif num == 2:

        return True

    elif num % 2 == 0:

        return False



    sqrtNum = sqrt(num)

    for i in range(3, int(sqrtNum) + 1, 2):

        if num % i == 0:

            return False



    return True





def make_divisors(num):

    divisors = []

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

        if num % i == 0:

            divisors.append(i)

            if i != num // i:

                divisors.append(num//i)



    # divisors.sort()

    return divisors





if __name__ == "__main__":

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



    A_list = make_divisors(A)

    B_list = make_divisors(B)



    AB_list = set(A_list) & set(B_list)



    ans = list()

    for i in AB_list:

        if IsPrime(i):

            ans.append(i)



    print((len(ans)))

import math



a, b = list(map(int, input().split()))



list_a = []

list_b = []

sqrt_a = math.sqrt(a)

sqrt_b = math.sqrt(b)





for i in range(2, int(sqrt_a)):

    if (a % (i) == 0):

        list_a.append(i)

        while(a % (i) == 0):

            a = a//(i)

if a != 1:

    list_a.append(a)



for i in range(2, int(sqrt_b)):

    if (b % (i) == 0):

        list_b.append(i)

        while(b % (i) == 0):

            b = b//(i)

if b != 1:

    list_b.append(b)



# print(list_a)

# print(list_b)



set_a = set(list_a)

set_b = set(list_b)



set_ab = set_a & set_b



print((len(set_ab) + 1))

from math import sqrt


def IsPrime(num):
    if num < 2:
        return True
    elif num == 2:
        return True
    elif num % 2 == 0:
        return False
    sqrtNum = sqrt(num)
    for i in range(3, int(sqrtNum) + 1, 2):
        if num % i == 0:
            return False
    return True


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


if __name__ == "__main__":
    A, B = list(map(int, input().split()))
    A_list = make_divisors(A)
    B_list = make_divisors(B)
    AB_list = set(A_list) & set(B_list)
    ans = list()
    for i in AB_list:
        if IsPrime(i):
            ans.append(i)
    print((len(ans)))

import math

a, b = list(map(int, input().split()))
list_a = []
list_b = []
sqrt_a = math.sqrt(a)
sqrt_b = math.sqrt(b)
for i in range(2, int(sqrt_a)):
    if a % (i) == 0:
        list_a.append(i)
        while a % (i) == 0:
            a = a // (i)
if a != 1:
    list_a.append(a)
for i in range(2, int(sqrt_b)):
    if b % (i) == 0:
        list_b.append(i)
        while b % (i) == 0:
            b = b // (i)
if b != 1:
    list_b.append(b)
# print(list_a)
# print(list_b)
set_a = set(list_a)
set_b = set(list_b)
set_ab = set_a & set_b
print((len(set_ab) + 1))

-from math import sqrt +import math - -def IsPrime(num): -    if num < 2: -        return True -    elif num == 2: -        return True -    elif num % 2 == 0: -        return False -    sqrtNum = sqrt(num) -    for i in range(3, int(sqrtNum) + 1, 2): -        if num % i == 0: -            return False -    return True - - -def make_divisors(num): -    divisors = [] -    for i in range(1, int(num**0.5) + 1): -        if num % i == 0: -            divisors.append(i) -            if i != num // i: -                divisors.append(num // i) -    # divisors.sort() -    return divisors - - -if __name__ == "__main__": -    A, B = list(map(int, input().split())) -    A_list = make_divisors(A) -    B_list = make_divisors(B) -    AB_list = set(A_list) & set(B_list) -    ans = list() -    for i in AB_list: -        if IsPrime(i): -            ans.append(i) -    print((len(ans))) +a, b = list(map(int, input().split())) +list_a = [] +list_b = [] +sqrt_a = math.sqrt(a) +sqrt_b = math.sqrt(b) +for i in range(2, int(sqrt_a)): +    if a % (i) == 0: +        list_a.append(i) +        while a % (i) == 0: +            a = a // (i) +if a != 1: +    list_a.append(a) +for i in range(2, int(sqrt_b)): +    if b % (i) == 0: +        list_b.append(i) +        while b % (i) == 0: +            b = b // (i) +if b != 1: +    list_b.append(b) +# print(list_a) +# print(list_b) +set_a = set(list_a) +set_b = set(list_b) +set_ab = set_a & set_b +print((len(set_ab) + 1))