from fractions import gcd

def factorization(n):
    res = []
    m = 2
    while m ** 2 <= n:
        if n % m == 0:
            cnt = 0
            while n % m == 0:
                cnt += 1
                n //= m
            res.append([m, cnt])
        m += 1

    if n > 1:
        res.append([n, 1])

    return res


a, b = map(int, input().split())
print(len(factorization(gcd(a, b))) + 1) from fractions import gcd def factorization(n):
    res = []
    m = 2
    while m ** 2 <= n:
        if n % m == 0:
            cnt = 0
            while n % m == 0:
                cnt += 1
                n //= m
            res.append([m, cnt])
        m += 1

    if n > 1:
        res.append([n, 1])

    return res factorization res = [] res [] m = 2 m 2 while m ** 2 <= n:
        if n % m == 0:
            cnt = 0
            while n % m == 0:
                cnt += 1
                n //= m
            res.append([m, cnt])
        m += 1

     m ** 2 <= n m ** 2 m 2 n if n % m == 0:
            cnt = 0
            while n % m == 0:
                cnt += 1
                n //= m
            res.append([m, cnt])
         n % m == 0 n % m n m 0 cnt = 0 cnt 0 while n % m == 0:
                cnt += 1
                n //= m
             n % m == 0 n % m n m 0 cnt += 1 cnt 1 n //= m n m res.append([m, cnt]) res.append res append [m, cnt] m cnt m += 1 m 1 if n > 1:
        res.append([n, 1])

     n > 1 n 1 res.append([n, 1]) res.append res append [n, 1] n 1 return res res n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b print(len(factorization(gcd(a, b))) + 1) print len(factorization(gcd(a, b))) + 1 len(factorization(gcd(a, b))) len factorization(gcd(a, b)) factorization gcd(a, b) gcd a b 1 def factorization(n):
    res = []
    m = 2
    while m ** 2 <= n:
        if n % m == 0:
            cnt = 0
            while n % m == 0:
                cnt += 1
                n //= m
            res.append([m, cnt])
        m += 1

    if n > 1:
        res.append([n, 1])

    return res def factorization(n):
    res = []
    m = 2
    while m ** 2 <= n:
        if n % m == 0:
            cnt = 0
            while n % m == 0:
                cnt += 1
                n //= m
            res.append([m, cnt])
        m += 1

    if n > 1:
        res.append([n, 1])

    return res factorization 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 factorization(n):
    res = []
    m = 2
    while m ** 2 <= n:
        if n % m == 0:
            cnt = 0
            while n % m == 0:
                cnt += 1
                n //= m
            res.append([m, cnt])
        m += 1

    if n > 1:
        res.append([n, 1])

    return res


a, b = map(int, input().split())
print(len(factorization(gcd(a, b))) + 1)