import itertools

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)



    # divisors.sort()

    return divisors

import math



def is_prime(n):

    if n == 1: return False



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

        if n % k == 0:

            return False



    return True

c = make_divisors(a)

d = make_divisors(b)



f = list(set(c) & set(d))

ans = []



for s in f:

    if is_prime(s):

        ans.append(s)

print((len(ans)+1))
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



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

list_A = set(prime_factorize(a))

list_B = set(prime_factorize(b))

ans = list_A & list_B

print((len(ans) + 1))

import itertools

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)
    # divisors.sort()
    return divisors


import math


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


c = make_divisors(a)
d = make_divisors(b)
f = list(set(c) & set(d))
ans = []
for s in f:
    if is_prime(s):
        ans.append(s)
print((len(ans) + 1))

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


a, b = list(map(int, input().split()))
list_A = set(prime_factorize(a))
list_B = set(prime_factorize(b))
ans = list_A & list_B
print((len(ans) + 1))

-import itertools +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 + -# 約数 -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 - - -import math - - -def is_prime(n): -    if n == 1: -        return False -    for k in range(2, int(math.sqrt(n)) + 1): -        if n % k == 0: -            return False -    return True - - -c = make_divisors(a) -d = make_divisors(b) -f = list(set(c) & set(d)) -ans = [] -for s in f: -    if is_prime(s): -        ans.append(s) +list_A = set(prime_factorize(a)) +list_B = set(prime_factorize(b)) +ans = list_A & list_B