import sys



input = sys.stdin.readline



def is_prime(N):

    prime = set()

    

    if not N % 2: prime.add(2)

    while not N % 2: N //= 2

    

    x = 3

    

    while x ** 2 <= N:

        if not N % x: prime.add(x)

        while not N % x: N //= x

        x += 2

        

    if N > 1: prime.add(N)

    

    return prime





def main():

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

    

    a = is_prime(A)

    b = is_prime(B)

    

    print((len(a & b) + 1))



if __name__ == '__main__':

    main()
def gcd(a, b):

    while b:

        r = a % b

        a, b = b, r

    return a



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

n = gcd(A, B)



ans = 1

if not n % 2: ans += 1



while not n % 2:

    n //= 2



i = 3



while i <= n**0.5:

    if not n % i: ans += 1

    while not n % i:

        n //= i

    i += 2



if 1 < n: ans += 1

print(ans)
import sys

input = sys.stdin.readline


def is_prime(N):
    prime = set()
    if not N % 2:
        prime.add(2)
    while not N % 2:
        N //= 2
    x = 3
    while x**2 <= N:
        if not N % x:
            prime.add(x)
        while not N % x:
            N //= x
        x += 2
    if N > 1:
        prime.add(N)
    return prime


def main():
    A, B = list(map(int, input().split()))
    a = is_prime(A)
    b = is_prime(B)
    print((len(a & b) + 1))


if __name__ == "__main__":
    main()

def gcd(a, b):
    while b:
        r = a % b
        a, b = b, r
    return a


A, B = list(map(int, input().split()))
n = gcd(A, B)
ans = 1
if not n % 2:
    ans += 1
while not n % 2:
    n //= 2
i = 3
while i <= n**0.5:
    if not n % i:
        ans += 1
    while not n % i:
        n //= i
    i += 2
if 1 < n:
    ans += 1
print(ans)

-import sys - -input = sys.stdin.readline +def gcd(a, b): +    while b: +        r = a % b +        a, b = b, r +    return a -def is_prime(N): -    prime = set() -    if not N % 2: -        prime.add(2) -    while not N % 2: -        N //= 2 -    x = 3 -    while x**2 <= N: -        if not N % x: -            prime.add(x) -        while not N % x: -            N //= x -        x += 2 -    if N > 1: -        prime.add(N) -    return prime - - -def main(): -    A, B = list(map(int, input().split())) -    a = is_prime(A) -    b = is_prime(B) -    print((len(a & b) + 1)) - - -if __name__ == "__main__": -    main() +A, B = list(map(int, input().split())) +n = gcd(A, B) +ans = 1 +if not n % 2: +    ans += 1 +while not n % 2: +    n //= 2 +i = 3 +while i <= n**0.5: +    if not n % i: +        ans += 1 +    while not n % i: +        n //= i +    i += 2 +if 1 < n: +    ans += 1 +print(ans)