import  math

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


def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

C = math.gcd(A, B)




print(len(set(prime_factorization(C))) + 1)
 import  math math int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x A, B = [int(x) for x in input().split()] A [int(x) for x in input().split()] B def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors prime_factorization i = 2 i 2 factors = [] factors [] while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
     i * i <= n i * i i i n if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
     n % i n i i += 1 i 1 n //= i n i factors.append(i) factors.append factors append i if n > 1:
        factors.append(n)
     n > 1 n 1 factors.append(n) factors.append factors append n return factors factors n n C = math.gcd(A, B) C math.gcd(A, B) math.gcd math gcd A B print(len(set(prime_factorization(C))) + 1) print len(set(prime_factorization(C))) + 1 len(set(prime_factorization(C))) len set(prime_factorization(C)) set prime_factorization(C) prime_factorization C 1 A, B = [int(x) for x in input().split()] [int(x) for x in input().split()] A def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors prime_factorization C = math.gcd(A, B) math.gcd(A, B) C B = [int(x) for x in input().split()] [int(x) for x in input().split()] B
import  math

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


def prime_factorization(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

C = math.gcd(A, B)




print(len(set(prime_factorization(C))) + 1)

