import math

def primes(n):

    l= []

    for i in range(2,math.floor(math.sqrt(n))):

        while n % i == 0:

            n = n//i

            l.append(i)

        if n == 1: 

            break

    

    if n > 1:

        l.append(n)

    return l



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

sa=set(primes(a))

sb=set(primes(b))

sans=sa.intersection(sb)

print((len(sans)+1))
def prime_factors(n):

    res = set()

    while n % 2 == 0:

        res.add(2)

        n //= 2

    i = 3

    while i * i <= n:

        if n % i == 0:

            res.add(i)

            n //= i

        else:

            i += 2

    if n != 1:

        res.add(n)

    return res



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

a = prime_factors(a)

b = prime_factors(b)

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

import math


def primes(n):
    l = []
    for i in range(2, math.floor(math.sqrt(n))):
        while n % i == 0:
            n = n // i
            l.append(i)
        if n == 1:
            break
    if n > 1:
        l.append(n)
    return l


a, b = list(map(int, input().split()))
sa = set(primes(a))
sb = set(primes(b))
sans = sa.intersection(sb)
print((len(sans) + 1))

def prime_factors(n):
    res = set()
    while n % 2 == 0:
        res.add(2)
        n //= 2
    i = 3
    while i * i <= n:
        if n % i == 0:
            res.add(i)
            n //= i
        else:
            i += 2
    if n != 1:
        res.add(n)
    return res


a, b = list(map(int, input().split()))
a = prime_factors(a)
b = prime_factors(b)
print((len(a & b) + 1))

-import math - - -def primes(n): -    l = [] -    for i in range(2, math.floor(math.sqrt(n))): -        while n % i == 0: -            n = n // i -            l.append(i) -        if n == 1: -            break -    if n > 1: -        l.append(n) -    return l +def prime_factors(n): +    res = set() +    while n % 2 == 0: +        res.add(2) +        n //= 2 +    i = 3 +    while i * i <= n: +        if n % i == 0: +            res.add(i) +            n //= i +        else: +            i += 2 +    if n != 1: +        res.add(n) +    return res -sa = set(primes(a)) -sb = set(primes(b)) -sans = sa.intersection(sb) -print((len(sans) + 1)) +a = prime_factors(a) +b = prime_factors(b) +print((len(a & b) + 1))