#gcd

from fractions import gcd



#素因数分解

def primefact(x0):

    tmp_l = [1]

    if x0 == 1:

        return tmp_l

    i = 2

    while 1:

        if i > pow(x0,1/2):

            if x0 == 1:

                break

            tmp_l.append(x0)

            break

        if x0 % i == 0:

            tmp_l.append(i)

            while x0 % i == 0:

                x0 //= i   

        i+=1

    return tmp_l





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



g = gcd(a,b)

print((len(primefact(g))))
#素因数分解

def prime_factorize(x0):

    tmp_l = [1]

    if x0 == 1:

        return tmp_l

    if x0%2 == 0:

        tmp_l.append(2)

        while x0 % 2 == 0:

            x0 //=2

    if x0 > 2:

        i = 3

        while 1:

            if i > pow(x0,1/2):

                if x0 == 1:

                    break

                tmp_l.append(x0)

                break

            if x0 % i == 0:

                tmp_l.append(i)

                while x0 % i == 0:

                    x0 //= i   

            i+=2

    return tmp_l



#最大公約数

def gcd(x0, y0):

    if x0<y0:

        tmp0 = x0

        x0 = y0

        y0 = tmp0

    if y0 == 0:

        return x0

    else:

        return gcd(y0, x0 % y0)

        

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



g = gcd(a,b)

print((len(prime_factorize(g))))
# gcd
from fractions import gcd

# 素因数分解
def primefact(x0):
    tmp_l = [1]
    if x0 == 1:
        return tmp_l
    i = 2
    while 1:
        if i > pow(x0, 1 / 2):
            if x0 == 1:
                break
            tmp_l.append(x0)
            break
        if x0 % i == 0:
            tmp_l.append(i)
            while x0 % i == 0:
                x0 //= i
        i += 1
    return tmp_l


a, b = list(map(int, input().split()))
g = gcd(a, b)
print((len(primefact(g))))

# 素因数分解
def prime_factorize(x0):
    tmp_l = [1]
    if x0 == 1:
        return tmp_l
    if x0 % 2 == 0:
        tmp_l.append(2)
        while x0 % 2 == 0:
            x0 //= 2
    if x0 > 2:
        i = 3
        while 1:
            if i > pow(x0, 1 / 2):
                if x0 == 1:
                    break
                tmp_l.append(x0)
                break
            if x0 % i == 0:
                tmp_l.append(i)
                while x0 % i == 0:
                    x0 //= i
            i += 2
    return tmp_l


# 最大公約数
def gcd(x0, y0):
    if x0 < y0:
        tmp0 = x0
        x0 = y0
        y0 = tmp0
    if y0 == 0:
        return x0
    else:
        return gcd(y0, x0 % y0)


a, b = list(map(int, input().split()))
g = gcd(a, b)
print((len(prime_factorize(g))))

-# gcd -from fractions import gcd - -def primefact(x0): +def prime_factorize(x0): -    i = 2 -    while 1: -        if i > pow(x0, 1 / 2): -            if x0 == 1: +    if x0 % 2 == 0: +        tmp_l.append(2) +        while x0 % 2 == 0: +            x0 //= 2 +    if x0 > 2: +        i = 3 +        while 1: +            if i > pow(x0, 1 / 2): +                if x0 == 1: +                    break +                tmp_l.append(x0) -            tmp_l.append(x0) -            break -        if x0 % i == 0: -            tmp_l.append(i) -            while x0 % i == 0: -                x0 //= i -        i += 1 +            if x0 % i == 0: +                tmp_l.append(i) +                while x0 % i == 0: +                    x0 //= i +            i += 2 + + +# 最大公約数 +def gcd(x0, y0): +    if x0 < y0: +        tmp0 = x0 +        x0 = y0 +        y0 = tmp0 +    if y0 == 0: +        return x0 +    else: +        return gcd(y0, x0 % y0) -print((len(primefact(g)))) +print((len(prime_factorize(g))))