import math

import fractions



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

gcd = fractions.gcd(A,B)

N = int(math.ceil(math.sqrt(gcd)))

cd = []



for i in range(1,N):

    if A%i==0 and B%i==0:

        cd.append(i)

        cd.append(gcd//i)

if N==1:

    cd.append(N)



ans=0

cd.sort()





for i in range(len(cd)):

    tr=1

    for j in range(1,i):

        if cd[i]%cd[j]==0:

            tr=0

            break

    if tr==1:

        ans+=1



print(ans)
import sys

input = sys.stdin.readline



def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



def main():

    def factorization(n):

        if n==1:

            return []

        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

    

    mod=10**9+7

    a,b=MI()

    from math import gcd

    g=gcd(a,b)

    arr=factorization(g)

    

    ans=len(arr)+1

    

    print(ans)

    

    

    



main()

import math
import fractions

A, B = list(map(int, input().split()))
gcd = fractions.gcd(A, B)
N = int(math.ceil(math.sqrt(gcd)))
cd = []
for i in range(1, N):
    if A % i == 0 and B % i == 0:
        cd.append(i)
        cd.append(gcd // i)
if N == 1:
    cd.append(N)
ans = 0
cd.sort()
for i in range(len(cd)):
    tr = 1
    for j in range(1, i):
        if cd[i] % cd[j] == 0:
            tr = 0
            break
    if tr == 1:
        ans += 1
print(ans)

import sys

input = sys.stdin.readline


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def main():
    def factorization(n):
        if n == 1:
            return []
        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

    mod = 10**9 + 7
    a, b = MI()
    from math import gcd

    g = gcd(a, b)
    arr = factorization(g)
    ans = len(arr) + 1
    print(ans)


main()

-import math -import fractions +import sys -A, B = list(map(int, input().split())) -gcd = fractions.gcd(A, B) -N = int(math.ceil(math.sqrt(gcd))) -cd = [] -for i in range(1, N): -    if A % i == 0 and B % i == 0: -        cd.append(i) -        cd.append(gcd // i) -if N == 1: -    cd.append(N) -ans = 0 -cd.sort() -for i in range(len(cd)): -    tr = 1 -    for j in range(1, i): -        if cd[i] % cd[j] == 0: -            tr = 0 -            break -    if tr == 1: -        ans += 1 -print(ans) +input = sys.stdin.readline + + +def I(): +    return int(eval(input())) + + +def MI(): +    return list(map(int, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +def main(): +    def factorization(n): +        if n == 1: +            return [] +        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 + +    mod = 10**9 + 7 +    a, b = MI() +    from math import gcd + +    g = gcd(a, b) +    arr = factorization(g) +    ans = len(arr) + 1 +    print(ans) + + +main()