import math



def divisors(x):

    l = [[], []]

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

        if x % i == 0:

            if i**2 != x:

                l[0].append(i)

                l[1].append(x//i)

            else:

                l[0].append(i)

    return l[0]+l[1][::-1]



def primenumber(x):

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

        if x % i == 0:

            return False

    return True



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

cnt = 0

for i in divisors(math.gcd(a, b)):

    if i == 1:

        cnt += 1

    elif primenumber(i):

        cnt += 1

print(cnt)
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



from math import sqrt

from math import gcd

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

x = gcd(a, b)

print((len(set(prime_factorize(x)))+1))
import math


def divisors(x):
    l = [[], []]
    for i in range(1, int(math.sqrt(x)) + 1):
        if x % i == 0:
            if i**2 != x:
                l[0].append(i)
                l[1].append(x // i)
            else:
                l[0].append(i)
    return l[0] + l[1][::-1]


def primenumber(x):
    for i in range(2, int(math.sqrt(x)) + 1):
        if x % i == 0:
            return False
    return True


a, b = list(map(int, input().split()))
cnt = 0
for i in divisors(math.gcd(a, b)):
    if i == 1:
        cnt += 1
    elif primenumber(i):
        cnt += 1
print(cnt)

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


from math import sqrt
from math import gcd

a, b = list(map(int, input().split()))
x = gcd(a, b)
print((len(set(prime_factorize(x))) + 1))

-import math +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 -def divisors(x): -    l = [[], []] -    for i in range(1, int(math.sqrt(x)) + 1): -        if x % i == 0: -            if i**2 != x: -                l[0].append(i) -                l[1].append(x // i) -            else: -                l[0].append(i) -    return l[0] + l[1][::-1] - - -def primenumber(x): -    for i in range(2, int(math.sqrt(x)) + 1): -        if x % i == 0: -            return False -    return True - +from math import sqrt +from math import gcd -cnt = 0 -for i in divisors(math.gcd(a, b)): -    if i == 1: -        cnt += 1 -    elif primenumber(i): -        cnt += 1 -print(cnt) +x = gcd(a, b) +print((len(set(prime_factorize(x))) + 1))