import fractions



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

g=fractions.gcd(a,b)

#print(g)

ans=1

i=2

while i*i<=g:

    if(g%i==0):

        ans+=1

        while g%i==0:

            g/=i

    i=i+1

if(g!=1):ans+=1

print(ans)
from fractions import gcd

 

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



def factorization(n):

    arr = []

    temp = n

    for i in range(2, int(-(-n**0.5//1))+1):

        if temp%i==0:

            cnt=0

            while temp%i==0:

                cnt+=1

                temp //= i

            arr.append([i, cnt])



    if temp!=1:

        arr.append([temp, 1])



    if arr==[]:

        arr.append([n, 1])



    return arr

x=gcd(a,b)

if x!=1:

    print((len(factorization(x))+1))

else:

    print((1))
import fractions

a, b = list(map(int, input().split()))
g = fractions.gcd(a, b)
# print(g)
ans = 1
i = 2
while i * i <= g:
    if g % i == 0:
        ans += 1
        while g % i == 0:
            g /= i
    i = i + 1
if g != 1:
    ans += 1
print(ans)

from fractions import gcd

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


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-(n**0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


x = gcd(a, b)
if x != 1:
    print((len(factorization(x)) + 1))
else:
    print((1))

-import fractions +from fractions import gcd -g = fractions.gcd(a, b) -# print(g) -ans = 1 -i = 2 -while i * i <= g: -    if g % i == 0: -        ans += 1 -        while g % i == 0: -            g /= i -    i = i + 1 -if g != 1: -    ans += 1 -print(ans) + + +def factorization(n): +    arr = [] +    temp = n +    for i in range(2, int(-(-(n**0.5) // 1)) + 1): +        if temp % i == 0: +            cnt = 0 +            while temp % i == 0: +                cnt += 1 +                temp //= i +            arr.append([i, cnt]) +    if temp != 1: +        arr.append([temp, 1]) +    if arr == []: +        arr.append([n, 1]) +    return arr + + +x = gcd(a, b) +if x != 1: +    print((len(factorization(x)) + 1)) +else: +    print((1))