import math

def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor

def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


def main():
    a,b = tuple(map(int,input().split()))

    g = math.gcd(a,b)
    factors = factorization(g)
    print(len(factors)+1)

if __name__ == "__main__":
    main() import math math def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]] primelist is_prime = [True] * (n + 1) is_prime [True] * (n + 1) [True] True n + 1 n 1 is_prime[0] = False is_prime[0] is_prime 0 False is_prime[1] = False is_prime[1] is_prime 1 False for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
     i range(2, int(n**0.5) + 1) range 2 int(n**0.5) + 1 int(n**0.5) int n**0.5 n 0.5 1 if not is_prime[i]:
            continue
         not is_prime[i] is_prime[i] is_prime i continue for j in range(i * 2, n + 1, i):
            is_prime[j] = False
     j range(i * 2, n + 1, i) range i * 2 i 2 n + 1 n 1 i is_prime[j] = False is_prime[j] is_prime j False i for i in range(n + 1) if is_prime[i] for i in range(n + 1) if is_prime[i] i range(n + 1) range n + 1 n 1 is_prime[i] is_prime i if is_prime[i] i return [i for i in range(n + 1) if is_prime[i]] [i for i in range(n + 1) if is_prime[i]] n n def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor factorization plist = primelist(int(n**0.5)) plist primelist(int(n**0.5)) primelist int(n**0.5) int n**0.5 n 0.5 factor = [] factor [] for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
     p plist k = 0 k 0 while n%p==0:
            k+=1
            n//=p
         n%p==0 n%p n p 0 k+=1 k 1 n//=p n p if k>0:
            factor.append((p,k))
         k>0 k 0 factor.append((p,k)) factor.append factor append (p,k) p k if n==1:
            break
     n==1 n 1 break if n!=1:
        factor.append((n,1))

     n!=1 n 1 factor.append((n,1)) factor.append factor append (n,1) n 1 return factor factor n n def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors divisors divisors = [] divisors [] for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

     i range(1, int(n**0.5)+1) range 1 int(n**0.5)+1 int(n**0.5) int n**0.5 n 0.5 1 if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

     n % i == 0 n % i n i 0 divisors.append(i) divisors.append divisors append i if i != n // i:
                divisors.append(n//i)

     i != n // i i n // i n i divisors.append(n//i) divisors.append divisors append n//i n i divisors.sort() divisors.sort divisors sort return divisors divisors n n def main():
    a,b = tuple(map(int,input().split()))

    g = math.gcd(a,b)
    factors = factorization(g)
    print(len(factors)+1) main a,b = tuple(map(int,input().split())) a tuple(map(int,input().split())) tuple map(int,input().split()) map int input().split() ().split () input split b g = math.gcd(a,b) g math.gcd(a,b) math.gcd math gcd a b factors = factorization(g) factors factorization(g) factorization g print(len(factors)+1) print len(factors)+1 len(factors) len factors 1 if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]] def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]] primelist def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors divisors def main():
    a,b = tuple(map(int,input().split()))

    g = math.gcd(a,b)
    factors = factorization(g)
    print(len(factors)+1) def main():
    a,b = tuple(map(int,input().split()))

    g = math.gcd(a,b)
    factors = factorization(g)
    print(len(factors)+1) main def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor factorization
import math

def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor

def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


def main():
    a,b = tuple(map(int,input().split()))

    g = math.gcd(a,b)
    factors = factorization(g)
    print(len(factors)+1)

if __name__ == "__main__":
    main()
