from fractions import gcd


def make_prime_factors2(n):
    """自然数nの素因数を列挙した圧縮済みリストを出力する
    計算量：O(sqrt(N))
    入出力例：156 -> [(2, 2), (3, 1), (13, 1)]
    """
    prime_factors = []
    for k in range(2, int(n**0.5) + 1):
        cnt = 0
        while n % k == 0:
            cnt += 1
            n = n // k
        if cnt != 0:
            prime_factors.append((k, cnt))
    if n != 1:
        prime_factors.append((n, 1))
    return prime_factors


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

li = make_prime_factors2(gcd(a, b))
print(len(li) + 1) from fractions import gcd def make_prime_factors2(n):
    """自然数nの素因数を列挙した圧縮済みリストを出力する
    計算量：O(sqrt(N))
    入出力例：156 -> [(2, 2), (3, 1), (13, 1)]
    """
    prime_factors = []
    for k in range(2, int(n**0.5) + 1):
        cnt = 0
        while n % k == 0:
            cnt += 1
            n = n // k
        if cnt != 0:
            prime_factors.append((k, cnt))
    if n != 1:
        prime_factors.append((n, 1))
    return prime_factors make_prime_factors2 """自然数nの素因数を列挙した圧縮済みリストを出力する
    計算量：O(sqrt(N))
    入出力例：156 -> [(2, 2), (3, 1), (13, 1)]
    """ prime_factors = [] prime_factors [] for k in range(2, int(n**0.5) + 1):
        cnt = 0
        while n % k == 0:
            cnt += 1
            n = n // k
        if cnt != 0:
            prime_factors.append((k, cnt))
     k 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 cnt = 0 cnt 0 while n % k == 0:
            cnt += 1
            n = n // k
         n % k == 0 n % k n k 0 cnt += 1 cnt 1 n = n // k n n // k n k if cnt != 0:
            prime_factors.append((k, cnt))
     cnt != 0 cnt 0 prime_factors.append((k, cnt)) prime_factors.append prime_factors append (k, cnt) k cnt if n != 1:
        prime_factors.append((n, 1))
     n != 1 n 1 prime_factors.append((n, 1)) prime_factors.append prime_factors append (n, 1) n 1 return prime_factors prime_factors n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b li = make_prime_factors2(gcd(a, b)) li make_prime_factors2(gcd(a, b)) make_prime_factors2 gcd(a, b) gcd a b print(len(li) + 1) print len(li) + 1 len(li) len li 1 a, b = map(int, input().split()) map(int, input().split()) a def make_prime_factors2(n):
    """自然数nの素因数を列挙した圧縮済みリストを出力する
    計算量：O(sqrt(N))
    入出力例：156 -> [(2, 2), (3, 1), (13, 1)]
    """
    prime_factors = []
    for k in range(2, int(n**0.5) + 1):
        cnt = 0
        while n % k == 0:
            cnt += 1
            n = n // k
        if cnt != 0:
            prime_factors.append((k, cnt))
    if n != 1:
        prime_factors.append((n, 1))
    return prime_factors def make_prime_factors2(n):
    """自然数nの素因数を列挙した圧縮済みリストを出力する
    計算量：O(sqrt(N))
    入出力例：156 -> [(2, 2), (3, 1), (13, 1)]
    """
    prime_factors = []
    for k in range(2, int(n**0.5) + 1):
        cnt = 0
        while n % k == 0:
            cnt += 1
            n = n // k
        if cnt != 0:
            prime_factors.append((k, cnt))
    if n != 1:
        prime_factors.append((n, 1))
    return prime_factors make_prime_factors2 li = make_prime_factors2(gcd(a, b)) make_prime_factors2(gcd(a, b)) li b = map(int, input().split()) map(int, input().split()) b
from fractions import gcd


def make_prime_factors2(n):
    """自然数nの素因数を列挙した圧縮済みリストを出力する
    計算量：O(sqrt(N))
    入出力例：156 -> [(2, 2), (3, 1), (13, 1)]
    """
    prime_factors = []
    for k in range(2, int(n**0.5) + 1):
        cnt = 0
        while n % k == 0:
            cnt += 1
            n = n // k
        if cnt != 0:
            prime_factors.append((k, cnt))
    if n != 1:
        prime_factors.append((n, 1))
    return prime_factors


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

li = make_prime_factors2(gcd(a, b))
print(len(li) + 1)
