from fractions import gcd



def prime_decomposition(n): #素因数分解

  i = 2

  table = []

  while i*i <= n:

    while n%i == 0:

      n /= i

      table.append(i)

    i += 1

  if n > 1:

    table.append(int(n))

  # 重複なし

  return set(table)



A, B = list(map(int, input().split()))

n_gcd = gcd(A, B)

n_div = prime_decomposition(n_gcd)

print((len(n_div)+1))


from math import gcd

def resolve():

    def prime_factorize(n):

        if 2 <= n < 4:

            return [n]

        res = []

        i = 2

        while i * i <= n:

            while n % i == 0:

                res.append(i)

                n //= i

            i += 1

        if n != 1:

            res.append(n)



        return set(res)



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



    g = gcd(a, b)

    ans = prime_factorize(g)

    print((len(ans) + 1))





if __name__ == "__main__":

    resolve()

from fractions import gcd


def prime_decomposition(n):  # 素因数分解
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(int(n))
    # 重複なし
    return set(table)


A, B = list(map(int, input().split()))
n_gcd = gcd(A, B)
n_div = prime_decomposition(n_gcd)
print((len(n_div) + 1))

from math import gcd


def resolve():
    def prime_factorize(n):
        if 2 <= n < 4:
            return [n]
        res = []
        i = 2
        while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
        if n != 1:
            res.append(n)
        return set(res)

    a, b = list(map(int, input().split()))
    g = gcd(a, b)
    ans = prime_factorize(g)
    print((len(ans) + 1))


if __name__ == "__main__":
    resolve()

-from fractions import gcd +from math import gcd -def prime_decomposition(n):  # 素因数分解 -    i = 2 -    table = [] -    while i * i <= n: -        while n % i == 0: -            n /= i -            table.append(i) -        i += 1 -    if n > 1: -        table.append(int(n)) -    # 重複なし -    return set(table) +def resolve(): +    def prime_factorize(n): +        if 2 <= n < 4: +            return [n] +        res = [] +        i = 2 +        while i * i <= n: +            while n % i == 0: +                res.append(i) +                n //= i +            i += 1 +        if n != 1: +            res.append(n) +        return set(res) + +    a, b = list(map(int, input().split())) +    g = gcd(a, b) +    ans = prime_factorize(g) +    print((len(ans) + 1)) -A, B = list(map(int, input().split())) -n_gcd = gcd(A, B) -n_div = prime_decomposition(n_gcd) -print((len(n_div) + 1)) +if __name__ == "__main__": +    resolve()