A, B = list(map(int, input().split()))
import math


def prime_numbers(n):
    """n以下の素数列挙"""
    eratosthenes = [True] * (n + 1)
    eratosthenes[1] = False
    prime_list = []
    for i in range(2, n + 1):

        if eratosthenes[i]:
            k = 2
            while True:
                if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
            prime_list.append(i)
    return prime_list


def prime_factorization(n: int):
    factors = []
    tmp_n = n
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        count_divide = 0
        while True:
            tmp_n = n
            s, r = divmod(tmp_n, i)
            if r == 0:
                count_divide += 1
                n = s
            else:
                break
        if count_divide >= 1:
            factors.append([i, count_divide])
    if tmp_n > 1:
        factors.append([tmp_n, 1])
    return factors


a_b_max = max(A, B)
a_b_min = min(A, B)
max_factors = prime_factorization(a_b_max)
min_factors = prime_factorization(a_b_min)
j = 0
ans = 1
for p, i in max_factors:
    while True:
        if j == len(min_factors):
            break
        if min_factors[j][0] == p:
            ans += 1
            j += 1
        elif min_factors[j][0] < p:
            j += 1
        else:
            break

print(ans)
# ans = 1
# for p in prime_list:
#     a_s, a_r = divmod(A, p)
#     b_s, b_r = divmod(B, p)
#     if A % p == 0 and B % p == 0:
#         ans += 1 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 import math math def prime_numbers(n):
    """n以下の素数列挙"""
    eratosthenes = [True] * (n + 1)
    eratosthenes[1] = False
    prime_list = []
    for i in range(2, n + 1):

        if eratosthenes[i]:
            k = 2
            while True:
                if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
            prime_list.append(i)
    return prime_list prime_numbers """n以下の素数列挙""" eratosthenes = [True] * (n + 1) eratosthenes [True] * (n + 1) [True] True n + 1 n 1 eratosthenes[1] = False eratosthenes[1] eratosthenes 1 False prime_list = [] prime_list [] for i in range(2, n + 1):

        if eratosthenes[i]:
            k = 2
            while True:
                if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
            prime_list.append(i)
     i range(2, n + 1) range 2 n + 1 n 1 if eratosthenes[i]:
            k = 2
            while True:
                if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
            prime_list.append(i)
     eratosthenes[i] eratosthenes i k = 2 k 2 while True:
                if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
             True if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
             i * k < n + 1 i * k i k n + 1 n 1 eratosthenes[i * k] = False eratosthenes[i * k] eratosthenes i * k i k False k += 1 k 1 break prime_list.append(i) prime_list.append prime_list append i return prime_list prime_list n n def prime_factorization(n: int):
    factors = []
    tmp_n = n
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        count_divide = 0
        while True:
            tmp_n = n
            s, r = divmod(tmp_n, i)
            if r == 0:
                count_divide += 1
                n = s
            else:
                break
        if count_divide >= 1:
            factors.append([i, count_divide])
    if tmp_n > 1:
        factors.append([tmp_n, 1])
    return factors prime_factorization factors = [] factors [] tmp_n = n tmp_n n for i in range(2, math.ceil(math.sqrt(n)) + 1):
        count_divide = 0
        while True:
            tmp_n = n
            s, r = divmod(tmp_n, i)
            if r == 0:
                count_divide += 1
                n = s
            else:
                break
        if count_divide >= 1:
            factors.append([i, count_divide])
     i range(2, math.ceil(math.sqrt(n)) + 1) range 2 math.ceil(math.sqrt(n)) + 1 math.ceil(math.sqrt(n)) math.ceil math ceil math.sqrt(n) math.sqrt math sqrt n 1 count_divide = 0 count_divide 0 while True:
            tmp_n = n
            s, r = divmod(tmp_n, i)
            if r == 0:
                count_divide += 1
                n = s
            else:
                break
         True tmp_n = n tmp_n n s, r = divmod(tmp_n, i) s divmod(tmp_n, i) divmod tmp_n i r if r == 0:
                count_divide += 1
                n = s
            else:
                break
         r == 0 r 0 count_divide += 1 count_divide 1 n = s n s break if count_divide >= 1:
            factors.append([i, count_divide])
     count_divide >= 1 count_divide 1 factors.append([i, count_divide]) factors.append factors append [i, count_divide] i count_divide if tmp_n > 1:
        factors.append([tmp_n, 1])
     tmp_n > 1 tmp_n 1 factors.append([tmp_n, 1]) factors.append factors append [tmp_n, 1] tmp_n 1 return factors factors n: int n a_b_max = max(A, B) a_b_max max(A, B) max A B a_b_min = min(A, B) a_b_min min(A, B) min A B max_factors = prime_factorization(a_b_max) max_factors prime_factorization(a_b_max) prime_factorization a_b_max min_factors = prime_factorization(a_b_min) min_factors prime_factorization(a_b_min) prime_factorization a_b_min j = 0 j 0 ans = 1 ans 1 for p, i in max_factors:
    while True:
        if j == len(min_factors):
            break
        if min_factors[j][0] == p:
            ans += 1
            j += 1
        elif min_factors[j][0] < p:
            j += 1
        else:
            break p i max_factors while True:
        if j == len(min_factors):
            break
        if min_factors[j][0] == p:
            ans += 1
            j += 1
        elif min_factors[j][0] < p:
            j += 1
        else:
            break True if j == len(min_factors):
            break
         j == len(min_factors) j len(min_factors) len min_factors break if min_factors[j][0] == p:
            ans += 1
            j += 1
        elif min_factors[j][0] < p:
            j += 1
        else:
            break min_factors[j][0] == p min_factors[j][0] [j] min_factors j 0 p ans += 1 ans 1 j += 1 j 1 elif min_factors[j][0] < p:
            j += 1
         min_factors[j][0] < p min_factors[j][0] [j] min_factors j 0 p j += 1 j 1 break print(ans) print ans j = 0 0 j a_b_min = min(A, B) min(A, B) a_b_min A, B = list(map(int, input().split())) list(map(int, input().split())) A def prime_numbers(n):
    """n以下の素数列挙"""
    eratosthenes = [True] * (n + 1)
    eratosthenes[1] = False
    prime_list = []
    for i in range(2, n + 1):

        if eratosthenes[i]:
            k = 2
            while True:
                if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
            prime_list.append(i)
    return prime_list def prime_numbers(n):
    """n以下の素数列挙"""
    eratosthenes = [True] * (n + 1)
    eratosthenes[1] = False
    prime_list = []
    for i in range(2, n + 1):

        if eratosthenes[i]:
            k = 2
            while True:
                if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
            prime_list.append(i)
    return prime_list prime_numbers B = list(map(int, input().split())) list(map(int, input().split())) B def prime_factorization(n: int):
    factors = []
    tmp_n = n
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        count_divide = 0
        while True:
            tmp_n = n
            s, r = divmod(tmp_n, i)
            if r == 0:
                count_divide += 1
                n = s
            else:
                break
        if count_divide >= 1:
            factors.append([i, count_divide])
    if tmp_n > 1:
        factors.append([tmp_n, 1])
    return factors def prime_factorization(n: int):
    factors = []
    tmp_n = n
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        count_divide = 0
        while True:
            tmp_n = n
            s, r = divmod(tmp_n, i)
            if r == 0:
                count_divide += 1
                n = s
            else:
                break
        if count_divide >= 1:
            factors.append([i, count_divide])
    if tmp_n > 1:
        factors.append([tmp_n, 1])
    return factors prime_factorization j += 1 1 j ans = 1 1 ans min_factors = prime_factorization(a_b_min) prime_factorization(a_b_min) min_factors max_factors = prime_factorization(a_b_max) prime_factorization(a_b_max) max_factors a_b_max = max(A, B) max(A, B) a_b_max ans += 1 1 ans j += 1 1 j
A, B = list(map(int, input().split()))
import math


def prime_numbers(n):
    """n以下の素数列挙"""
    eratosthenes = [True] * (n + 1)
    eratosthenes[1] = False
    prime_list = []
    for i in range(2, n + 1):

        if eratosthenes[i]:
            k = 2
            while True:
                if i * k < n + 1:
                    eratosthenes[i * k] = False
                    k += 1
                else:
                    break
            prime_list.append(i)
    return prime_list


def prime_factorization(n: int):
    factors = []
    tmp_n = n
    for i in range(2, math.ceil(math.sqrt(n)) + 1):
        count_divide = 0
        while True:
            tmp_n = n
            s, r = divmod(tmp_n, i)
            if r == 0:
                count_divide += 1
                n = s
            else:
                break
        if count_divide >= 1:
            factors.append([i, count_divide])
    if tmp_n > 1:
        factors.append([tmp_n, 1])
    return factors


a_b_max = max(A, B)
a_b_min = min(A, B)
max_factors = prime_factorization(a_b_max)
min_factors = prime_factorization(a_b_min)
j = 0
ans = 1
for p, i in max_factors:
    while True:
        if j == len(min_factors):
            break
        if min_factors[j][0] == p:
            ans += 1
            j += 1
        elif min_factors[j][0] < p:
            j += 1
        else:
            break

print(ans)
# ans = 1
# for p in prime_list:
#     a_s, a_r = divmod(A, p)
#     b_s, b_r = divmod(B, p)
#     if A % p == 0 and B % p == 0:
#         ans += 1
