import collections

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    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 = cin()
A, B = min(A, B), max(A, B)
res = collections.Counter(prime_factorize(A))
keys = list(res.keys())
keys.append(1)
ans = 0
for i in keys:
    if B % i == 0:
        ans += 1
print(ans) import collections collections def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_ cin in_ = list(map(int,input().split())) in_ list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split if len(in_) == 1:  return in_[0]
    else:  return in_ len(in_) == 1 len(in_) len in_ 1 def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    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 if n != 1:  a.append(n)
     n != 1 n 1 return a a n n A, B = cin() A cin() cin B A, B = min(A, B), max(A, B) A min(A, B) min A B B max(A, B) max A B res = collections.Counter(prime_factorize(A)) res collections.Counter(prime_factorize(A)) collections.Counter collections Counter prime_factorize(A) prime_factorize A keys = list(res.keys()) keys list(res.keys()) list res.keys() res.keys res keys keys.append(1) keys.append keys append 1 ans = 0 ans 0 for i in keys:
    if B % i == 0:
        ans += 1 i keys if B % i == 0:
        ans += 1 B % i == 0 B % i B i 0 ans += 1 ans 1 print(ans) print ans B = cin() cin() B A, B = min(A, B), max(A, B) min(A, B) A ans = 0 0 ans ans += 1 1 ans B = min(A, B), max(A, B) max(A, B) B def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_ def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_ cin res = collections.Counter(prime_factorize(A)) collections.Counter(prime_factorize(A)) res def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    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
    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 keys = list(res.keys()) list(res.keys()) keys A, B = cin() cin() A
import collections

def cin():
    in_ = list(map(int,input().split()))
    if len(in_) == 1:  return in_[0]
    else:  return in_

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    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 = cin()
A, B = min(A, B), max(A, B)
res = collections.Counter(prime_factorize(A))
keys = list(res.keys())
keys.append(1)
ans = 0
for i in keys:
    if B % i == 0:
        ans += 1
print(ans)