import fractions

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

n = fractions.gcd(a, b)



def prime_decomposition(n):

    i = 2

    table = []

    while i * i <= n:

        while n % i == 0:

            n //= i

            table.append(i)

        i += 1

    if n > 1:

        table.append(n)

    return table



print((len(set(prime_decomposition(n)))+1))
import fractions

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

common_num = fractions.gcd(a, b)

 

ans = 1

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

  if common_num % i == 0:

    ans += 1

    while common_num % i == 0:

      common_num //= i

if common_num > 1:

  ans += 1

      

print(ans)
import fractions

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


def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table


print((len(set(prime_decomposition(n))) + 1))

import fractions

a, b = list(map(int, input().split()))
common_num = fractions.gcd(a, b)
ans = 1
for i in range(2, int(1 + common_num**0.5)):
    if common_num % i == 0:
        ans += 1
        while common_num % i == 0:
            common_num //= i
if common_num > 1:
    ans += 1
print(ans)

-n = fractions.gcd(a, b) - - -def prime_decomposition(n): -    i = 2 -    table = [] -    while i * i <= n: -        while n % i == 0: -            n //= i -            table.append(i) -        i += 1 -    if n > 1: -        table.append(n) -    return table - - -print((len(set(prime_decomposition(n))) + 1)) +common_num = fractions.gcd(a, b) +ans = 1 +for i in range(2, int(1 + common_num**0.5)): +    if common_num % i == 0: +        ans += 1 +        while common_num % i == 0: +            common_num //= i +if common_num > 1: +    ans += 1 +print(ans)