import sys

from heapq import heappop, heappush

from operator import itemgetter

from collections import deque, defaultdict, Counter

from bisect import bisect_left, bisect_right

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)

MOD = 10**9 + 7

INF = float('inf')



def primeCount(N):

    R = int(N**(0.5)) + 1  # 素数の範囲

    primes = {}  # 素数のリスト

    n = N

    for num in range(2, R):

        primes[num] = 0

        while n % num == 0:

            n //= num

            primes[num] += 1

    if n > 1 :

        primes[n] = 1

    return { key : val for key, val in list(primes.items()) if val > 0}  # フィルターをかける



def sol():

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



    primeA = primeCount(A)

    primeB = primeCount(B)



    ans = 1

    for a in list(primeA.keys()):

        if a in primeB:

            ans += 1



    print(ans)



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



def primeCount(N):

    R = int(N**(0.5)) + 1  # 素数の範囲

    primes = {}  # 素数のリスト

    n = N

    for num in range(2, R):

        primes[num] = 0

        while n % num == 0:

            n //= num

            primes[num] += 1

    if n > 1 :

        primes[n] = 1

    return { key : val for key, val in list(primes.items()) if val > 0}  # フィルターをかける



primeA = primeCount(A)

ans = 1

prd = 1

for p in sorted(primeA.keys()):

    if B % p == 0 and prd % p != 0:

        prd *= p

        ans += 1

print(ans)

import sys
from heapq import heappop, heappush
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7
INF = float("inf")


def primeCount(N):
    R = int(N ** (0.5)) + 1  # 素数の範囲
    primes = {}  # 素数のリスト
    n = N
    for num in range(2, R):
        primes[num] = 0
        while n % num == 0:
            n //= num
            primes[num] += 1
    if n > 1:
        primes[n] = 1
    return {key: val for key, val in list(primes.items()) if val > 0}  # フィルターをかける


def sol():
    A, B = list(map(int, input().split()))
    primeA = primeCount(A)
    primeB = primeCount(B)
    ans = 1
    for a in list(primeA.keys()):
        if a in primeB:
            ans += 1
    print(ans)


sol()

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


def primeCount(N):
    R = int(N ** (0.5)) + 1  # 素数の範囲
    primes = {}  # 素数のリスト
    n = N
    for num in range(2, R):
        primes[num] = 0
        while n % num == 0:
            n //= num
            primes[num] += 1
    if n > 1:
        primes[n] = 1
    return {key: val for key, val in list(primes.items()) if val > 0}  # フィルターをかける


primeA = primeCount(A)
ans = 1
prd = 1
for p in sorted(primeA.keys()):
    if B % p == 0 and prd % p != 0:
        prd *= p
        ans += 1
print(ans)

-import sys -from heapq import heappop, heappush -from operator import itemgetter -from collections import deque, defaultdict, Counter -from bisect import bisect_left, bisect_right - -input = sys.stdin.readline -sys.setrecursionlimit(10**7) -MOD = 10**9 + 7 -INF = float("inf") +A, B = list(map(int, input().split())) -def sol(): -    A, B = list(map(int, input().split())) -    primeA = primeCount(A) -    primeB = primeCount(B) -    ans = 1 -    for a in list(primeA.keys()): -        if a in primeB: -            ans += 1 -    print(ans) - - -sol() +primeA = primeCount(A) +ans = 1 +prd = 1 +for p in sorted(primeA.keys()): +    if B % p == 0 and prd % p != 0: +        prd *= p +        ans += 1 +print(ans)