def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
a, b = map(int, input().split())
n = gcd(a, b)
primes = []
MAX = 10 ** 6 + 10
is_prime = [False] * 2 + [True] * (MAX - 2)
for i in range(2, MAX):
    if is_prime[i]:
        primes.append(i)
        for j in range(i * i, MAX, i):
            is_prime[j] = False
cnt = 1
for p in primes:
    if n % p == 0:
        cnt += 1
        while n % p == 0:
            n /= p
if n != 1:
    cnt += 1
print(cnt) def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b) gcd if b == 0:
        return a
     b == 0 b 0 return a a return gcd(b, a % b) gcd(b, a % b) gcd b a % b a b a a b b a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b n = gcd(a, b) n gcd(a, b) gcd a b primes = [] primes [] MAX = 10 ** 6 + 10 MAX 10 ** 6 + 10 10 ** 6 10 6 10 is_prime = [False] * 2 + [True] * (MAX - 2) is_prime [False] * 2 + [True] * (MAX - 2) [False] * 2 [False] False 2 [True] * (MAX - 2) [True] True MAX - 2 MAX 2 for i in range(2, MAX):
    if is_prime[i]:
        primes.append(i)
        for j in range(i * i, MAX, i):
            is_prime[j] = False i range(2, MAX) range 2 MAX if is_prime[i]:
        primes.append(i)
        for j in range(i * i, MAX, i):
            is_prime[j] = False is_prime[i] is_prime i primes.append(i) primes.append primes append i for j in range(i * i, MAX, i):
            is_prime[j] = False j range(i * i, MAX, i) range i * i i i MAX i is_prime[j] = False is_prime[j] is_prime j False cnt = 1 cnt 1 for p in primes:
    if n % p == 0:
        cnt += 1
        while n % p == 0:
            n /= p p primes if n % p == 0:
        cnt += 1
        while n % p == 0:
            n /= p n % p == 0 n % p n p 0 cnt += 1 cnt 1 while n % p == 0:
            n /= p n % p == 0 n % p n p 0 n /= p n p if n != 1:
    cnt += 1 n != 1 n 1 cnt += 1 cnt 1 print(cnt) print cnt n /= p p n cnt = 1 1 cnt a, b = map(int, input().split()) map(int, input().split()) a is_prime = [False] * 2 + [True] * (MAX - 2) [False] * 2 + [True] * (MAX - 2) is_prime cnt += 1 1 cnt def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b) def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b) gcd n = gcd(a, b) gcd(a, b) n MAX = 10 ** 6 + 10 10 ** 6 + 10 MAX primes = [] [] primes cnt += 1 1 cnt b = map(int, input().split()) map(int, input().split()) b
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
a, b = map(int, input().split())
n = gcd(a, b)
primes = []
MAX = 10 ** 6 + 10
is_prime = [False] * 2 + [True] * (MAX - 2)
for i in range(2, MAX):
    if is_prime[i]:
        primes.append(i)
        for j in range(i * i, MAX, i):
            is_prime[j] = False
cnt = 1
for p in primes:
    if n % p == 0:
        cnt += 1
        while n % p == 0:
            n /= p
if n != 1:
    cnt += 1
print(cnt)