from collections import Counter

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def pf(N):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res

def main():
    a, b = map(int, input().split())
    print(len(Counter(pf(gcd(a,b))))+1)

if __name__ == "__main__":
    main() from collections import Counter def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n gcd r = m % n r m % n m n return gcd(n, r) if r else n gcd(n, r) if r else n r gcd(n, r) gcd n r n m m n n def pf(N):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res pf res = [] res [] x = N x N y = 2 y 2 while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
     y*y <= x y*y y y x while x % y == 0:
            res.append(y)
            x //= y
         x % y == 0 x % y x y 0 res.append(y) res.append res append y x //= y x y y += 1 y 1 if x > 1:
        res.append(x)
     x > 1 x 1 res.append(x) res.append res append x return res res N N def main():
    a, b = map(int, input().split())
    print(len(Counter(pf(gcd(a,b))))+1) main a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b print(len(Counter(pf(gcd(a,b))))+1) print len(Counter(pf(gcd(a,b))))+1 len(Counter(pf(gcd(a,b)))) len Counter(pf(gcd(a,b))) Counter pf(gcd(a,b)) pf gcd(a,b) gcd a b 1 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def pf(N):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res def pf(N):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res pf def main():
    a, b = map(int, input().split())
    print(len(Counter(pf(gcd(a,b))))+1) def main():
    a, b = map(int, input().split())
    print(len(Counter(pf(gcd(a,b))))+1) main def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n gcd
from collections import Counter

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def pf(N):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res

def main():
    a, b = map(int, input().split())
    print(len(Counter(pf(gcd(a,b))))+1)

if __name__ == "__main__":
    main()