from fractions import gcd

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

C=gcd(A,B)



if C==1:

   print((1))

else:

   count=1

   C_copy=C

   n=2

   while n**2<=C:

      flag=False

      while C_copy%n==0:

         C_copy//=n

         flag=True

      if flag:

         count+=1

         n=n+1 if n==2 else n+2

      else:

         n=n+1 if n==2 else n+2

   

   if C_copy!=1:

      count+=1



   print(count)
def primes(n):

   is_prime = [True] * (n + 1)

   is_prime[0] = False

   is_prime[1] = False

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

      if not is_prime[i]:

         continue

      for j in range(i * 2, n + 1, i):

         is_prime[j] = False

   return [i for i in range(n + 1) if is_prime[i]]



from fractions import gcd

import math

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

C=gcd(A,B)

prime_numbers=primes(int(math.sqrt(C))+1)



if C==1:

   print((1))

else:

   count=1



   for p in prime_numbers:

      if C==1:

         break

      

      flag=False

      while C%p==0:

         C//=p

         flag=True

      if flag:

         count+=1

         p=p+1 if p==2 else p+2

      else:

         p=p+1 if p==2 else p+2

   

   if C!=1:

      count+=1



   print(count)
from fractions import gcd

A, B = list(map(int, input().split()))
C = gcd(A, B)
if C == 1:
    print((1))
else:
    count = 1
    C_copy = C
    n = 2
    while n**2 <= C:
        flag = False
        while C_copy % n == 0:
            C_copy //= n
            flag = True
        if flag:
            count += 1
            n = n + 1 if n == 2 else n + 2
        else:
            n = n + 1 if n == 2 else n + 2
    if C_copy != 1:
        count += 1
    print(count)

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]


from fractions import gcd
import math

A, B = list(map(int, input().split()))
C = gcd(A, B)
prime_numbers = primes(int(math.sqrt(C)) + 1)
if C == 1:
    print((1))
else:
    count = 1
    for p in prime_numbers:
        if C == 1:
            break
        flag = False
        while C % p == 0:
            C //= p
            flag = True
        if flag:
            count += 1
            p = p + 1 if p == 2 else p + 2
        else:
            p = p + 1 if p == 2 else p + 2
    if C != 1:
        count += 1
    print(count)

+def primes(n): +    is_prime = [True] * (n + 1) +    is_prime[0] = False +    is_prime[1] = False +    for i in range(2, int(n**0.5) + 1): +        if not is_prime[i]: +            continue +        for j in range(i * 2, n + 1, i): +            is_prime[j] = False +    return [i for i in range(n + 1) if is_prime[i]] + + +import math +prime_numbers = primes(int(math.sqrt(C)) + 1) -    C_copy = C -    n = 2 -    while n**2 <= C: +    for p in prime_numbers: +        if C == 1: +            break -        while C_copy % n == 0: -            C_copy //= n +        while C % p == 0: +            C //= p -            n = n + 1 if n == 2 else n + 2 +            p = p + 1 if p == 2 else p + 2 -            n = n + 1 if n == 2 else n + 2 -    if C_copy != 1: +            p = p + 1 if p == 2 else p + 2 +    if C != 1: