import math

import fractions

gcd = math.gcd if hasattr(math, "gcd") else fractions.gcd



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



def factorize(n):

    b = 2

    fct = []

    while b * b <= n:

        while n % b == 0:

            n //= b

            fct.append(b)

        b = b + 1

    if n > 1:

        fct.append(n)

    return fct



g = gcd(A, B)



print((len(set(factorize(g)))+1))

import math

from fractions import gcd



def factorization(n):

    arr = []

    tmp = n

    for div in range(2, int(math.sqrt(n)) + 2):

        if tmp % div == 0:

            cnt = 0

            while tmp % div == 0:

                cnt += 1

                tmp //= div

            arr.append([div, cnt])



    if tmp != 1:

        arr.append([tmp, 1])



    if len(arr) == 0:

        arr.append([n, 1])



    return arr



if __name__ == '__main__':

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

    g = gcd(A, B)

    if g == 1:

        print((1))

        exit()

    facts = factorization(g)

    print((len(facts) + 1))
import math
import fractions

gcd = math.gcd if hasattr(math, "gcd") else fractions.gcd
A, B = list(map(int, input().split()))


def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct


g = gcd(A, B)
print((len(set(factorize(g))) + 1))

import math
from fractions import gcd


def factorization(n):
    arr = []
    tmp = n
    for div in range(2, int(math.sqrt(n)) + 2):
        if tmp % div == 0:
            cnt = 0
            while tmp % div == 0:
                cnt += 1
                tmp //= div
            arr.append([div, cnt])
    if tmp != 1:
        arr.append([tmp, 1])
    if len(arr) == 0:
        arr.append([n, 1])
    return arr


if __name__ == "__main__":
    A, B = list(map(int, input().split()))
    g = gcd(A, B)
    if g == 1:
        print((1))
        exit()
    facts = factorization(g)
    print((len(facts) + 1))

-import fractions - -gcd = math.gcd if hasattr(math, "gcd") else fractions.gcd -A, B = list(map(int, input().split())) +from fractions import gcd -def factorize(n): -    b = 2 -    fct = [] -    while b * b <= n: -        while n % b == 0: -            n //= b -            fct.append(b) -        b = b + 1 -    if n > 1: -        fct.append(n) -    return fct +def factorization(n): +    arr = [] +    tmp = n +    for div in range(2, int(math.sqrt(n)) + 2): +        if tmp % div == 0: +            cnt = 0 +            while tmp % div == 0: +                cnt += 1 +                tmp //= div +            arr.append([div, cnt]) +    if tmp != 1: +        arr.append([tmp, 1]) +    if len(arr) == 0: +        arr.append([n, 1]) +    return arr -g = gcd(A, B) -print((len(set(factorize(g))) + 1)) +if __name__ == "__main__": +    A, B = list(map(int, input().split())) +    g = gcd(A, B) +    if g == 1: +        print((1)) +        exit() +    facts = factorization(g) +    print((len(facts) + 1))