from collections import Counter
def prime_factorize(n):
    f = 2
    primes = []
    while f * f <= n:
        if n % f != 0:
            f += 1
            continue
        primes.append(f)
        n //= f
    if n > 1:
        primes.append(n)
    return list(set(primes))
a, b = map(int, input().split())
ab_primes = Counter(prime_factorize(a) + prime_factorize(b))
ans = 0
for prime in ab_primes.values():
    if prime > 1:
        ans += 1
print(1 + ans) from collections import Counter def prime_factorize(n):
    f = 2
    primes = []
    while f * f <= n:
        if n % f != 0:
            f += 1
            continue
        primes.append(f)
        n //= f
    if n > 1:
        primes.append(n)
    return list(set(primes)) prime_factorize f = 2 f 2 primes = [] primes [] while f * f <= n:
        if n % f != 0:
            f += 1
            continue
        primes.append(f)
        n //= f
     f * f <= n f * f f f n if n % f != 0:
            f += 1
            continue
         n % f != 0 n % f n f 0 f += 1 f 1 continue primes.append(f) primes.append primes append f n //= f n f if n > 1:
        primes.append(n)
     n > 1 n 1 primes.append(n) primes.append primes append n return list(set(primes)) list(set(primes)) list set(primes) set primes n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b ab_primes = Counter(prime_factorize(a) + prime_factorize(b)) ab_primes Counter(prime_factorize(a) + prime_factorize(b)) Counter prime_factorize(a) + prime_factorize(b) prime_factorize(a) prime_factorize a prime_factorize(b) prime_factorize b ans = 0 ans 0 for prime in ab_primes.values():
    if prime > 1:
        ans += 1 prime ab_primes.values() ab_primes.values ab_primes values if prime > 1:
        ans += 1 prime > 1 prime 1 ans += 1 ans 1 print(1 + ans) print 1 + ans 1 ans ans = 0 0 ans ans += 1 1 ans b = map(int, input().split()) map(int, input().split()) b a, b = map(int, input().split()) map(int, input().split()) a ab_primes = Counter(prime_factorize(a) + prime_factorize(b)) Counter(prime_factorize(a) + prime_factorize(b)) ab_primes def prime_factorize(n):
    f = 2
    primes = []
    while f * f <= n:
        if n % f != 0:
            f += 1
            continue
        primes.append(f)
        n //= f
    if n > 1:
        primes.append(n)
    return list(set(primes)) def prime_factorize(n):
    f = 2
    primes = []
    while f * f <= n:
        if n % f != 0:
            f += 1
            continue
        primes.append(f)
        n //= f
    if n > 1:
        primes.append(n)
    return list(set(primes)) prime_factorize
from collections import Counter
def prime_factorize(n):
    f = 2
    primes = []
    while f * f <= n:
        if n % f != 0:
            f += 1
            continue
        primes.append(f)
        n //= f
    if n > 1:
        primes.append(n)
    return list(set(primes))
a, b = map(int, input().split())
ab_primes = Counter(prime_factorize(a) + prime_factorize(b))
ans = 0
for prime in ab_primes.values():
    if prime > 1:
        ans += 1
print(1 + ans)