import fractions

import math

from collections import Counter

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

n = fractions.gcd(a, b)



prime_count = Counter()

for i in range(2, math.ceil(math.sqrt(n))+1):

  while n % i == 0:

    n /= i

    prime_count[i] += 1

if n > 1:

  prime_count[int(n)] += 1



print((len(prime_count)+1))
import fractions

import math

from collections import Counter

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

C = fractions.gcd(A, B)



prime_count = Counter()

for i in range(2, math.ceil(math.sqrt(C))+1):

  while C % i == 0:

    C /= i

    prime_count[i] += 1

if C > 1:

  prime_count[int(C)] += 1



print((len(prime_count)+1))
import fractions
import math
from collections import Counter

a, b = list(map(int, input().split()))
n = fractions.gcd(a, b)
prime_count = Counter()
for i in range(2, math.ceil(math.sqrt(n)) + 1):
    while n % i == 0:
        n /= i
        prime_count[i] += 1
if n > 1:
    prime_count[int(n)] += 1
print((len(prime_count) + 1))

import fractions
import math
from collections import Counter

A, B = list(map(int, input().split()))
C = fractions.gcd(A, B)
prime_count = Counter()
for i in range(2, math.ceil(math.sqrt(C)) + 1):
    while C % i == 0:
        C /= i
        prime_count[i] += 1
if C > 1:
    prime_count[int(C)] += 1
print((len(prime_count) + 1))

-a, b = list(map(int, input().split())) -n = fractions.gcd(a, b) +A, B = list(map(int, input().split())) +C = fractions.gcd(A, B) -for i in range(2, math.ceil(math.sqrt(n)) + 1): -    while n % i == 0: -        n /= i +for i in range(2, math.ceil(math.sqrt(C)) + 1): +    while C % i == 0: +        C /= i -if n > 1: -    prime_count[int(n)] += 1 +if C > 1: +    prime_count[int(C)] += 1