import numpy as np





# ユークリッドの互除法

def ea(x, y):

    if x < y:

        x, y = y, x

    while x % y != 0:

        x = x % y

        x, y = y, x

    return y





# 素因数分解

def pf(x, p):

    for i in range(2, int(np.sqrt(x)) + 1):

        cnt = 0

        while x % i == 0:

            x /= i

            cnt += 1

        if cnt != 0:

            p.append([i, cnt])

    if x != 1:

        p.append([int(x), 1])





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

p = []



gcd = ea(A, B)

pf(gcd, p)



ans = 0



p.insert(0, [1, 1])



for i in range(len(p)):

    ans += 1



# print(p)

print(ans)

from math import sqrt

from fractions import gcd



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



ans = 1



g = gcd(A, B)



for i in range(2, 1 + int(sqrt(g))):



    if g % i == 0:

        ans += 1



        while g % i == 0:

            g //= i



if g != 1:

    ans += 1



print(ans)

import numpy as np

# ユークリッドの互除法
def ea(x, y):
    if x < y:
        x, y = y, x
    while x % y != 0:
        x = x % y
        x, y = y, x
    return y


# 素因数分解
def pf(x, p):
    for i in range(2, int(np.sqrt(x)) + 1):
        cnt = 0
        while x % i == 0:
            x /= i
            cnt += 1
        if cnt != 0:
            p.append([i, cnt])
    if x != 1:
        p.append([int(x), 1])


A, B = list(map(int, (input().split())))
p = []
gcd = ea(A, B)
pf(gcd, p)
ans = 0
p.insert(0, [1, 1])
for i in range(len(p)):
    ans += 1
# print(p)
print(ans)

from math import sqrt
from fractions import gcd

A, B = list(map(int, input().split()))
ans = 1
g = gcd(A, B)
for i in range(2, 1 + int(sqrt(g))):
    if g % i == 0:
        ans += 1
        while g % i == 0:
            g //= i
if g != 1:
    ans += 1
print(ans)

-import numpy as np +from math import sqrt +from fractions import gcd -# ユークリッドの互除法 -def ea(x, y): -    if x < y: -        x, y = y, x -    while x % y != 0: -        x = x % y -        x, y = y, x -    return y - - -# 素因数分解 -def pf(x, p): -    for i in range(2, int(np.sqrt(x)) + 1): -        cnt = 0 -        while x % i == 0: -            x /= i -            cnt += 1 -        if cnt != 0: -            p.append([i, cnt]) -    if x != 1: -        p.append([int(x), 1]) - - -A, B = list(map(int, (input().split()))) -p = [] -gcd = ea(A, B) -pf(gcd, p) -ans = 0 -p.insert(0, [1, 1]) -for i in range(len(p)): +A, B = list(map(int, input().split())) +ans = 1 +g = gcd(A, B) +for i in range(2, 1 + int(sqrt(g))): +    if g % i == 0: +        ans += 1 +        while g % i == 0: +            g //= i +if g != 1: -# print(p)