import sys

sys.setrecursionlimit(10 ** 7)



def gcd(a, b):

    while b:

        a, b = b, a % b

    return a



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



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

x = gcd(A, B)

prime_list = prime_decomposition(x)

s = set(prime_list)

print((len(s)+1))

import sys



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



A, B = lr()



def prime_factorize(n):

    a = []

    while n % 2 == 0:

        a.append(2)

        n //= 2

    f = 3

    while f * f <= n:

        if n % f == 0:

            a.append(f)

            n //= f

        else:

            f += 2

    if n != 1:

        a.append(n)

    return a



primes = prime_factorize(min(A, B))

answer = set()

for p in primes:

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

        answer.add(p)



print((len(answer) + 1)) # 1をプラス

# 35
import sys

sys.setrecursionlimit(10**7)


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


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


A, B = list(map(int, input().split()))
x = gcd(A, B)
prime_list = prime_decomposition(x)
s = set(prime_list)
print((len(s) + 1))

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
A, B = lr()


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


primes = prime_factorize(min(A, B))
answer = set()
for p in primes:
    if A % p == 0 and B % p == 0:
        answer.add(p)
print((len(answer) + 1))  # 1をプラス
# 35

-sys.setrecursionlimit(10**7) +sr = lambda: sys.stdin.readline().rstrip() +ir = lambda: int(sr()) +lr = lambda: list(map(int, sr().split())) +A, B = lr() -def gcd(a, b): -    while b: -        a, b = b, a % b +def prime_factorize(n): +    a = [] +    while n % 2 == 0: +        a.append(2) +        n //= 2 +    f = 3 +    while f * f <= n: +        if n % f == 0: +            a.append(f) +            n //= f +        else: +            f += 2 +    if n != 1: +        a.append(n) -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 - - -A, B = list(map(int, input().split())) -x = gcd(A, B) -prime_list = prime_decomposition(x) -s = set(prime_list) -print((len(s) + 1)) +primes = prime_factorize(min(A, B)) +answer = set() +for p in primes: +    if A % p == 0 and B % p == 0: +        answer.add(p) +print((len(answer) + 1))  # 1をプラス +# 35