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())
c = gcd(a,b)
print(len(set(factor(c)))+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 c = gcd(a,b) c gcd(a,b) gcd a b print(len(set(factor(c)))+1) print len(set(factor(c)))+1 len(set(factor(c))) len set(factor(c)) set factor(c) factor c 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 c = gcd(a,b) gcd(a,b) c a,b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b
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())
c = gcd(a,b)
print(len(set(factor(c)))+1)