from fractions import gcd


def factor(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    if n > 1:
        res.append(n)
    return res


A, B = map(int, input().split())
g = gcd(A, B)
print(len(set(factor(g))) + 1) from fractions import gcd def factor(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    if n > 1:
        res.append(n)
    return res factor res = [] res [] for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
     i range(2, int(n ** 0.5) + 1) range 2 int(n ** 0.5) + 1 int(n ** 0.5) int n ** 0.5 n 0.5 1 while n % i == 0:
            res.append(i)
            n //= i
     n % i == 0 n % i n i 0 res.append(i) res.append res append i n //= i n i if n > 1:
        res.append(n)
     n > 1 n 1 res.append(n) res.append res append n return res res n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B g = gcd(A, B) g gcd(A, B) gcd A B print(len(set(factor(g))) + 1) print len(set(factor(g))) + 1 len(set(factor(g))) len set(factor(g)) set factor(g) factor g 1 def factor(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    if n > 1:
        res.append(n)
    return res def factor(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    if n > 1:
        res.append(n)
    return res factor B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A g = gcd(A, B) gcd(A, B) g
from fractions import gcd


def factor(n):
    res = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            res.append(i)
            n //= i
    if n > 1:
        res.append(n)
    return res


A, B = map(int, input().split())
g = gcd(A, B)
print(len(set(factor(g))) + 1)
