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



#a,bの最大公約数

def gcd(a, b):

    while b:

        a, b = b, a % b

    return a



#nを素因数分解したリストを返す

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



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

import math

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



def factorization(n):

    arr=[]

    tmp=n

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

        while tmp%i==0:

            tmp//=i

            arr.append(i)

    if tmp!=1:

        arr.append(tmp)

    if arr==[]:

        arr.append(n)

    return list(set(arr))



ans=len(factorization(math.gcd(a,b)))

print((ans+1 if math.gcd(a,b)!=1 else 1))
a, b = list(map(int, input().split()))
# a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


# nを素因数分解したリストを返す
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


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

import math

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


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


ans = len(factorization(math.gcd(a, b)))
print((ans + 1 if math.gcd(a, b) != 1 else 1))

+import math + -# a,bの最大公約数 -def gcd(a, b): -    while b: -        a, b = b, a % b -    return a -# nを素因数分解したリストを返す -    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]) +    tmp = n +    for i in range(2, int(n**0.5) + 1): +        while tmp % i == 0: +            tmp //= i +            arr.append(i) +    if tmp != 1: +        arr.append(tmp) -        arr.append([n, 1]) -    return arr +        arr.append(n) +    return list(set(arr)) -print((len(factorization(gcd(a, b))) + 1 if gcd(a, b) != 1 else 1)) +ans = len(factorization(math.gcd(a, b))) +print((ans + 1 if math.gcd(a, b) != 1 else 1))