def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3

    # for f in range(3,int(n**0.5)+1,2):
    #     if n%f == 0:
    #         a.append(f)
    #         n //= f
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a, b = list(map(int,input().split()))
A, B = set(prime_factorize(a)), set(prime_factorize(b))
C = A&B
# print(A,B,C)

print(len(C)+1) def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3

    # for f in range(3,int(n**0.5)+1,2):
    #     if n%f == 0:
    #         a.append(f)
    #         n //= f
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a prime_factorize a = [] a [] while n % 2 == 0:
        a.append(2)
        n //= 2
     n % 2 == 0 n % 2 n 2 0 a.append(2) a.append a append 2 n //= 2 n 2 f = 3 f 3 while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
     f * f <= n f * f f f n if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
     n % f == 0 n % f n f 0 a.append(f) a.append a append f n //= f n f f += 2 f 2 if n != 1:
        a.append(n)
     n != 1 n 1 a.append(n) a.append a append n return a a n n a, b = list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split b A, B = set(prime_factorize(a)), set(prime_factorize(b)) A set(prime_factorize(a)) set prime_factorize(a) prime_factorize a B set(prime_factorize(b)) set prime_factorize(b) prime_factorize b C = A&B C A&B A B print(len(C)+1) print len(C)+1 len(C) len C 1 b = list(map(int,input().split())) list(map(int,input().split())) b a, b = list(map(int,input().split())) list(map(int,input().split())) a A, B = set(prime_factorize(a)), set(prime_factorize(b)) set(prime_factorize(a)) A C = A&B A&B C def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3

    # for f in range(3,int(n**0.5)+1,2):
    #     if n%f == 0:
    #         a.append(f)
    #         n //= f
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3

    # for f in range(3,int(n**0.5)+1,2):
    #     if n%f == 0:
    #         a.append(f)
    #         n //= f
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a prime_factorize B = set(prime_factorize(a)), set(prime_factorize(b)) set(prime_factorize(b)) B
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3

    # for f in range(3,int(n**0.5)+1,2):
    #     if n%f == 0:
    #         a.append(f)
    #         n //= f
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a, b = list(map(int,input().split()))
A, B = set(prime_factorize(a)), set(prime_factorize(b))
C = A&B
# print(A,B,C)

print(len(C)+1)