def factorization(n):

    res = set()

    tmp = n

    for i in range(2, int(n ** 0.5) // 1):

        if tmp % i == 0:

            while tmp % i == 0:

                tmp //= i

            res.add(i)

    res.add(tmp)

    return res



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

ans = factorization(a) & factorization(b) | {1}

print((len(ans)))

def f(n):

    res = set()

    for i in range(2, int(n ** 0.5) // 1):

        if n % i: continue

        while not n % i: n //= i

        res.add(i)

    return res | {n}



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

print((len(f(a) & f(b) | {1})))

def factorization(n):
    res = set()
    tmp = n
    for i in range(2, int(n**0.5) // 1):
        if tmp % i == 0:
            while tmp % i == 0:
                tmp //= i
            res.add(i)
    res.add(tmp)
    return res


a, b = list(map(int, input().split()))
ans = factorization(a) & factorization(b) | {1}
print((len(ans)))

def f(n):
    res = set()
    for i in range(2, int(n**0.5) // 1):
        if n % i:
            continue
        while not n % i:
            n //= i
        res.add(i)
    return res | {n}


a, b = list(map(int, input().split()))
print((len(f(a) & f(b) | {1})))

-def factorization(n): +def f(n): -    tmp = n -        if tmp % i == 0: -            while tmp % i == 0: -                tmp //= i -            res.add(i) -    res.add(tmp) -    return res +        if n % i: +            continue +        while not n % i: +            n //= i +        res.add(i) +    return res | {n} -ans = factorization(a) & factorization(b) | {1} -print((len(ans))) +print((len(f(a) & f(b) | {1})))