def gcd(a, b):

    if a % b == 0:

        return b

    else:

        return gcd(b, a % b)



def factorize(n):

    result = []

    dev = 2

    while dev ** 2 <= n:

        if n % dev == 0:

            n //= dev

            result.append(dev)

        else:

            dev += 1

    if n > 1:

        result.append(n)

    return result



A, B = [int(x) for x in input().split()]

lst = factorize(gcd(A, B))

print((len(set(lst)) + 1))
def gcd(a, b):

    if a % b == 0:

        return b

    else:

        return gcd(b, a % b)



def factorize(n):

    result = []

    dev = 2

    while dev * dev <= n:

        if n % dev == 0:

            n //= dev

            result.append(dev)

        else:

            dev += 1

    if n > 1:

        result.append(n)

    return result



A, B = [int(x) for x in input().split()]

lst = factorize(gcd(A, B))

print((len(set(lst)) + 1))
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)


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


A, B = [int(x) for x in input().split()]
lst = factorize(gcd(A, B))
print((len(set(lst)) + 1))

def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)


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


A, B = [int(x) for x in input().split()]
lst = factorize(gcd(A, B))
print((len(set(lst)) + 1))

-    while dev**2 <= n: +    while dev * dev <= n: