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





def prime_factor(n):

    d = set()

    for i in range(2, n + 1):

        if i * i > n:

            break

        while n % i == 0:

            d.add(i)

            n //= i

            

    if n != 1:

        d.add(n)

    return d



a = prime_factor(A)

b = prime_factor(B)

print((len(set(a) & set(b)) + 1))

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



def prime_factor(n):

    res = set([1])

    for i in range(2, n + 1):

        if i * i > n:

            break

            

        while n % i == 0:

            res.add(i)

            n //= i

            

    if n != 1:

        res.add(n)

        

    return res



print((len(prime_factor(A) & prime_factor(B))))

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


def prime_factor(n):
    d = set()
    for i in range(2, n + 1):
        if i * i > n:
            break
        while n % i == 0:
            d.add(i)
            n //= i
    if n != 1:
        d.add(n)
    return d


a = prime_factor(A)
b = prime_factor(B)
print((len(set(a) & set(b)) + 1))

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


def prime_factor(n):
    res = set([1])
    for i in range(2, n + 1):
        if i * i > n:
            break
        while n % i == 0:
            res.add(i)
            n //= i
    if n != 1:
        res.add(n)
    return res


print((len(prime_factor(A) & prime_factor(B))))

-    d = set() +    res = set([1]) -            d.add(i) +            res.add(i) -        d.add(n) -    return d +        res.add(n) +    return res -a = prime_factor(A) -b = prime_factor(B) -print((len(set(a) & set(b)) + 1)) +print((len(prime_factor(A) & prime_factor(B))))