import math

def trial_division(n):

    a = [1]

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

        while n % i == 0:

            n //= i

            a.append(i)

    a.append(n)

    return a

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

ans = set(trial_division(A)) & set(trial_division(B))

print((len(ans)))
import math

def trial_division(n):

    a = [1]

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

        while n % i == 0:

            n //= i

            a.append(i)

    a.append(n)

    return a



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

print((len(set(trial_division(A))&set(trial_division(B)))))
import math


def trial_division(n):
    a = [1]
    for i in range(2, int(math.sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            a.append(i)
    a.append(n)
    return a


A, B = list(map(int, input().split()))
ans = set(trial_division(A)) & set(trial_division(B))
print((len(ans)))

import math


def trial_division(n):
    a = [1]
    for i in range(2, int(math.sqrt(n)) + 1):
        while n % i == 0:
            n //= i
            a.append(i)
    a.append(n)
    return a


A, B = list(map(int, input().split()))
print((len(set(trial_division(A)) & set(trial_division(B)))))

-ans = set(trial_division(A)) & set(trial_division(B)) -print((len(ans))) +print((len(set(trial_division(A)) & set(trial_division(B)))))