import sys

import fractions

input = sys.stdin.readline

A, B = (int(i) for i in input().split())



gcd = fractions.gcd(A, B)

temp = gcd

count = 1

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

    if temp%i == 0:

        cnt = 0

        while temp%i ==0:

            cnt +=1

            temp //= i

        count +=1

if temp != 1:

    count +=1



print(count)

import sys

input = sys.stdin.readline

A, B = (int(i) for i in input().split())



def mygcd(a, b):

    while b!=0:

        a,b = b, a%b

    return a



gcd = mygcd(A, B)

temp = gcd

count = 1

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

    if temp%i == 0:

        cnt = 0

        while temp%i ==0:

            cnt +=1

            temp //= i

        count +=1

if temp != 1:

    count +=1



print(count)

import sys
import fractions

input = sys.stdin.readline
A, B = (int(i) for i in input().split())
gcd = fractions.gcd(A, B)
temp = gcd
count = 1
for i in range(2, int(-(-(gcd**0.5) // 1)) + 1):
    if temp % i == 0:
        cnt = 0
        while temp % i == 0:
            cnt += 1
            temp //= i
        count += 1
if temp != 1:
    count += 1
print(count)

import sys

input = sys.stdin.readline
A, B = (int(i) for i in input().split())


def mygcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


gcd = mygcd(A, B)
temp = gcd
count = 1
for i in range(2, int(-(-(gcd**0.5) // 1)) + 1):
    if temp % i == 0:
        cnt = 0
        while temp % i == 0:
            cnt += 1
            temp //= i
        count += 1
if temp != 1:
    count += 1
print(count)

-import fractions -gcd = fractions.gcd(A, B) + + +def mygcd(a, b): +    while b != 0: +        a, b = b, a % b +    return a + + +gcd = mygcd(A, B)