# 問題：https://atcoder.jp/contests/abc142/tasks/abc142_d

import math

def gcd(a, b):
    while b > 0:
        tmp = b
        b = a % b
        a = tmp
    return a


def count_prime_factorize(n):
    res = 1
    i = 2
    while i ** 2 <= n:
        if n % i == 0:
            res += 1
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res += 1
    return res


a, b = map(int, input().strip().split())
x = gcd(a, b)
res = count_prime_factorize(x)
print(res)
 import math math def gcd(a, b):
    while b > 0:
        tmp = b
        b = a % b
        a = tmp
    return a gcd while b > 0:
        tmp = b
        b = a % b
        a = tmp
     b > 0 b 0 tmp = b tmp b b = a % b b a % b a b a = tmp a tmp return a a a a b b def count_prime_factorize(n):
    res = 1
    i = 2
    while i ** 2 <= n:
        if n % i == 0:
            res += 1
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res += 1
    return res count_prime_factorize res = 1 res 1 i = 2 i 2 while i ** 2 <= n:
        if n % i == 0:
            res += 1
            while n % i == 0:
                n //= i
        i += 1
     i ** 2 <= n i ** 2 i 2 n if n % i == 0:
            res += 1
            while n % i == 0:
                n //= i
         n % i == 0 n % i n i 0 res += 1 res 1 while n % i == 0:
                n //= i
         n % i == 0 n % i n i 0 n //= i n i i += 1 i 1 if n != 1:
        res += 1
     n != 1 n 1 res += 1 res 1 return res res n n a, b = map(int, input().strip().split()) a map(int, input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split b x = gcd(a, b) x gcd(a, b) gcd a b res = count_prime_factorize(x) res count_prime_factorize(x) count_prime_factorize x print(res) print res def gcd(a, b):
    while b > 0:
        tmp = b
        b = a % b
        a = tmp
    return a def gcd(a, b):
    while b > 0:
        tmp = b
        b = a % b
        a = tmp
    return a gcd a, b = map(int, input().strip().split()) map(int, input().strip().split()) a x = gcd(a, b) gcd(a, b) x res = count_prime_factorize(x) count_prime_factorize(x) res b = map(int, input().strip().split()) map(int, input().strip().split()) b def count_prime_factorize(n):
    res = 1
    i = 2
    while i ** 2 <= n:
        if n % i == 0:
            res += 1
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res += 1
    return res def count_prime_factorize(n):
    res = 1
    i = 2
    while i ** 2 <= n:
        if n % i == 0:
            res += 1
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res += 1
    return res count_prime_factorize
# 問題：https://atcoder.jp/contests/abc142/tasks/abc142_d

import math

def gcd(a, b):
    while b > 0:
        tmp = b
        b = a % b
        a = tmp
    return a


def count_prime_factorize(n):
    res = 1
    i = 2
    while i ** 2 <= n:
        if n % i == 0:
            res += 1
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res += 1
    return res


a, b = map(int, input().strip().split())
x = gcd(a, b)
res = count_prime_factorize(x)
print(res)

