import math
import collections

def prime_factorize(n):
    s = []
    while n % 2 == 0:
        s.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            s.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        s.append(n)
    return s

a, b = map(int, input().split())

g = math.gcd(a, b)
c = collections.Counter(prime_factorize(g))

print(len(c.values()) + 1) import math math import collections collections def prime_factorize(n):
    s = []
    while n % 2 == 0:
        s.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            s.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        s.append(n)
    return s prime_factorize s = [] s [] while n % 2 == 0:
        s.append(2)
        n //= 2
     n % 2 == 0 n % 2 n 2 0 s.append(2) s.append s append 2 n //= 2 n 2 f = 3 f 3 while f * f <= n:
        if n % f == 0:
            s.append(f)
            n //= f
        else:
            f += 2
     f * f <= n f * f f f n if n % f == 0:
            s.append(f)
            n //= f
        else:
            f += 2
     n % f == 0 n % f n f 0 s.append(f) s.append s append f n //= f n f f += 2 f 2 if n != 1:
        s.append(n)
     n != 1 n 1 s.append(n) s.append s append n return s s n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b g = math.gcd(a, b) g math.gcd(a, b) math.gcd math gcd a b c = collections.Counter(prime_factorize(g)) c collections.Counter(prime_factorize(g)) collections.Counter collections Counter prime_factorize(g) prime_factorize g print(len(c.values()) + 1) print len(c.values()) + 1 len(c.values()) len c.values() c.values c values 1 b = map(int, input().split()) map(int, input().split()) b a, b = map(int, input().split()) map(int, input().split()) a c = collections.Counter(prime_factorize(g)) collections.Counter(prime_factorize(g)) c g = math.gcd(a, b) math.gcd(a, b) g def prime_factorize(n):
    s = []
    while n % 2 == 0:
        s.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            s.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        s.append(n)
    return s def prime_factorize(n):
    s = []
    while n % 2 == 0:
        s.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            s.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        s.append(n)
    return s prime_factorize
import math
import collections

def prime_factorize(n):
    s = []
    while n % 2 == 0:
        s.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            s.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        s.append(n)
    return s

a, b = map(int, input().split())

g = math.gcd(a, b)
c = collections.Counter(prime_factorize(g))

print(len(c.values()) + 1)