CodeEff/ECCO huggingface dataset:
# Original solution
import math
A,B=list(map(int,input().split()))
#nの約数を全て求める
def divisor(n):
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table
answers=[]
a=divisor(A)
b=divisor(B)
for a_ in a:
    if a_ in b:
        answers.append(a_)
n = len(answers)
numbers=[]
for i in range(2 ** n):
    number = []
    for j in range(n):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            number.append(answers[j])  # フラグが立っていたら bag に果物を詰める
    numbers.append(number)
del numbers[0]
answer=0
for number in numbers:
    ans=0
    for m in range(len(number)-1):
        for n in range(m+1,len(number)):
            a=math.gcd(number[m],number[n])
            if a!=1:
                ans=1
                break
    if ans==0:
        answer=max(answer,len(number))
print(answer)


# Optimized solution
A,B=list(map(int,input().split()))
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
a=make_divisors(A)
b=make_divisors(B)
kouyakusuu=set(a)&set(b)
out=[]
kouho=sorted(list(kouyakusuu))
del kouho[0]
for a in range(len(kouho)-1):
    for b in range(a+1,len(kouho)):
        if kouho[b]%kouho[a]==0:
            out.append(kouho[b])
answer=set(out)
print((len(kouho)+1-len(answer)))
# Original solution
import math
A, B = list(map(int, input().split()))

def gcd(A, B):
  if A < B:
    A, B = B, A
  while B > 0:
    temp = A % B
    A = B
    B = temp
  return A

gcd_num = gcd(A, B)

def prime(a):
  max_a = int(math.sqrt(a))
  d = dict()
  d[1] = 1
  i = 2
  while a != 1:
    if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
  return d
d = prime(gcd_num) 

print((len(d)))

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

def gcd(A, B):
  if A < B:
    A, B = B, A
  while B > 0:
    temp = A % B
    A = B
    B = temp
  return A

gcd_num = gcd(A, B)

def prime(a):
  max_a = 1 + int(math.sqrt(a))
  d = dict()
  d[1] = 1
  i = 2
  while a != 1:
    if i > max_a:
      d[a] = 1
      break
    if a % i == 0:
      a = a // i
      if i in d:
        d[i] += 1
      else:
        d[i] = 1
    else:
      i += 1
  return d
d = prime(gcd_num) 

print((len(d)))
# Original solution
#import sys

#input = sys.stdin.readline

#import heapq
import math
import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=list(map(int,input().split()))
    m=4
    k=1

    count=1
    if a>b:
        a,b=b,a
    sosu=set()
#    a = fractions.gcd(a,b)
    if a%2==0:
        sosu.add(2)
        while a%2==0:
            a//=2
    if a%3==0:
        sosu.add(3)
        while a%3==0:
            a//=3
#    print(d)
    c=math.sqrt(a)+1
 #   print(c)
    while m<=c and m!=1:
        if a%m==0:
            sosu.add(m)
            while a%m==0:
                a//=m

        m+=1
#    print(sosu)
    if sosu==set() and a!=1:
        sosu.add(a)
    if sosuhante(a) and a!=1:
        sosu.add(a)
#    print(sosu)

    for i in sosu:
        if b%i==0:
            count+=1
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()

# Optimized solution
#import sys

#input = sys.stdin.readline

#import heapq
import math
#import fractions

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True

def main():
#    h,w,a,b = map(int, input().split())
    a,b=list(map(int,input().split()))
    m=4
    k=1
    count=0

    if a>b:
        a,b=b,a
    sosu={1}
#    a = fractions.gcd(a,b)
    if a%2==0:
        sosu.add(2)
        while a%2==0:
            a//=2
    if a%3==0:
        sosu.add(3)
        while a%3==0:
            a//=3
#    print(d)
    c=math.sqrt(a)+1
 #   print(c)
    while m<=c and m!=1:
        if a%m==0:
            sosu.add(m)
            while a%m==0:
                a//=m

        m+=1
#    print(sosu)
    if a!=1:
        sosu.add(a)
#    print(sosu)

    for i in sosu:
        if b%i==0:
            count+=1
    print(count)
#    for i in range(h):
#            print(aaa)

if __name__ == "__main__":
    main()
# Original solution
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()

# Optimized solution
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)
# Original solution
import math
A, B = list(map(int, input().split()))

def is_prime(n):
    a = 0
    for k in range(1 + 1, int(math.sqrt(n)) + 1):
        if n % k == 0:
            a = 1
    if a == 1: return False
    else :return True

list1, list2 = [1], [1]
try:
    list1.extend([i for i in range(1+1, A+1) if A % i == 0
    and is_prime(i) == True])
    list2.extend([i for i in range(1+1, B+1) if B % i == 0
    and is_prime(i) == True])
except:
    pass

print((len(set(list1) & set(list2))))

# Optimized solution
A, B = list(map(int, input().split()))
 
def gcd(a, b):  # a,bの最大公約数
    while b:
        a, b = b, a % b
    return a

def factorization(n):  # nを素因数分解
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1): 
        if temp % i == 0: # 割り切れるとき
            cnt = 0
            while temp % i == 0: # 割れる限りカウント
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1: # まだ因数があるとき
        arr.append([temp, 1])
    if arr == []: # ｎが1のとき
        arr.append([n, 1])
    return arr
 
g = gcd(A, B) 
ans = len(factorization(g))

if g != 1:
    ans += 1
print(ans)
# Original solution
a,b = list(map(int,input().split()))
yakusuu = []
ans = 1
for i in range (2,min(a,b)+1):
         if a % i == 0 and b% i == 0:
                  yakusuu.append(i)
for j in range(len(yakusuu)):
         for k in range(2,yakusuu[j]):
                  if yakusuu[j] % k == 0:
                           break
         else:
                  ans += 1
print(ans)


# Optimized solution
aa,bb = list(map(int,input().split()))
n = min(aa,bb)
b = max(aa,bb)
ans = 1
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
         if temp%i==0:
                  cnt=0
                  while temp%i==0:
                           cnt+=1
                           temp //= i
                  arr.append(i)

if temp!=1:
         arr.append(temp)

if arr==[] and n != 1:
         arr.append(n)

for j in range(len(arr)):
         if b % arr[j] == 0:
                  ans += 1
print (ans)
# Original solution
import random


A, B = [int(str) for str in input().split()]

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def is_prime(q,k=2):
    q = abs(q)
    #計算するまでもなく判定できるものははじく
    if q == 2: return True
    if q < 2 or q&1 == 0: return False

    #n-1=2^s*dとし(但しaは整数、dは奇数)、dを求める
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    
    #判定をk回繰り返す
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        #[0,s-1]の範囲すべてをチェック
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

def make_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


prime_list = [1] + [i for i in range(1, gcd(A, B) + 1) if is_prime(i)]
print((len([i for i in prime_list if A % i == 0 and B % i == 0])))

# Optimized solution
A, B = [int(str) for str in input().split()]

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  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


print((len(set(prime_factorize(gcd(A, B)))) + 1))
# Original solution
import math

def gcd(n, m):
    while m != 0:
        n, m = m, n % m
    return n

a, b = list(map(int, input().split()))
g = gcd(a, b)
g_2 = int(math.sqrt(g))
cnt = 1

for i in range(2, g_2+1):
    if g % i == 0:
        while g % i == 0:
            g //= i
        cnt += 1
if g > 1:
    cnt += 1

print(cnt)


# Optimized solution
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


def prime_factorization(n):
    res = []
    for i in range(2, int(pow(n, 0.5)) + 1):
        if n % i == 0:
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append([i, ex])
    if n != 1:
        res.append([n, 1])
    return res


a, b = list(map(int, input().split()))
g = gcd(a, b)
res = prime_factorization(g)
print((len(res) + 1))
# Original solution
from math import gcd
from copy import copy
a, b = list(map(int, input().split()))

def div(x):
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            ret.append(i)
            ret.append(x // i)
    
    return ret

def judge_prime(x):
    cnt = 0
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            cnt += 1
    if cnt == 1:
        return True
    return False

div_a = div(a)
div_b = div(b)

data = list(set(div_a) & set(div_b))

ans = 0
for x in data:
    if judge_prime(x):
        ans += 1
print(ans)

# Optimized solution
from math import gcd
from copy import copy
a, b = list(map(int, input().split()))

def div(x):
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            ret.append(i)
            ret.append(x // i)
    
    return ret

def judge_prime(x):
    cnt = 0
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            cnt += 1
        if cnt >= 2:
            return False
    return True

div_a = div(a)
div_b = div(b)

data = list(set(div_a) & set(div_b))

ans = 0
for x in data:
    if judge_prime(x):
        ans += 1
print(ans)
# Original solution
import math

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

if a > b:
    a, b = b, a

# a_sq = int(math.sqrt(a)) + 1

com_div = []
# for i in range(1, a_sq + 1):
for i in range(1, a):
    if a % i == 0 and b % i == 0:
        com_div.append(i)
if len(com_div) == 1:
    print((1))
    exit()
    
ans = [1]
for i in range(1, len(com_div)):
    flg = 0
    for j in range(1, i):
        if com_div[i] % com_div[j] == 0:
            flg = 1
            break
    if flg == 0:
        ans.append(com_div[i])
print((len(ans)))

# Optimized solution
import math

a, b = list(map(int, input().split()))
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
ab_gcd = gcd(a, b)

gcd_sq = int(math.sqrt(ab_gcd) + 1)

ans = []
curr_num = ab_gcd
for i in range(2, gcd_sq):
    if curr_num % i != 0:
        continue
    cnt = 0
    while curr_num % i == 0:
        curr_num = curr_num // i
        cnt += 1
    ans.append([i, cnt])
if curr_num != 1:
    ans.append([curr_num, 1])
print((len(ans) + 1))
# Original solution
import sys

input = sys.stdin.readline

def is_prime(N):
    prime = set()
    
    if not N % 2: prime.add(2)
    while not N % 2: N //= 2
    
    x = 3
    
    while x ** 2 <= N:
        if not N % x: prime.add(x)
        while not N % x: N //= x
        x += 2
        
    if N > 1: prime.add(N)
    
    return prime


def main():
    A, B = list(map(int, input().split()))
    
    a = is_prime(A)
    b = is_prime(B)
    
    print((len(a & b) + 1))

if __name__ == '__main__':
    main()

# Optimized solution
def gcd(a, b):
    while b:
        r = a % b
        a, b = b, r
    return a

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

ans = 1
if not n % 2: ans += 1

while not n % 2:
    n //= 2

i = 3

while i <= n**0.5:
    if not n % i: ans += 1
    while not n % i:
        n //= i
    i += 2

if 1 < n: ans += 1
print(ans)
# Original solution
a,b = list(map(int,input().split()))

def fctr1(n): 
    f = []
    c = 0
    for i in range(2,int(n**0.5)+2):
        while n%i == 0:
            c += 1
            n = n//i
        if c !=0:
            f.append([i,c])
            c = 0
    if n != 1:
        f.append([n,1])
    return f

dlist = fctr1(a)
#print(dlist)
ans = 1
for i in range(len(dlist)):
    if b%dlist[i][0] == 0:
        ans += 1
print(ans)



# Optimized solution
#nの素因数分解(O(n**0.5)
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n%i == 0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass

#a,bの最大公約数
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

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

print((len(set(prime_factor(gcd(a,b))))+1))
# Original solution
import math

def divisors(x):
    l = [[], []]
    for i in range(1, int(math.sqrt(x))+1):
        if x % i == 0:
            if i**2 != x:
                l[0].append(i)
                l[1].append(x//i)
            else:
                l[0].append(i)
    return l[0]+l[1][::-1]

def primenumber(x):
    for i in range(2, int(math.sqrt(x))+1):
        if x % i == 0:
            return False
    return True

a, b = list(map(int, input().split()))
cnt = 0
for i in divisors(math.gcd(a, b)):
    if i == 1:
        cnt += 1
    elif primenumber(i):
        cnt += 1
print(cnt)

# Optimized solution
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

from math import sqrt
from math import gcd
a, b = list(map(int, input().split()))
x = gcd(a, b)
print((len(set(prime_factorize(x)))+1))
# Original solution
import math

def get_spf(n):
	ans = [i for i in range(n + 1)]

	for p in range(2, n + 1):
		if ans[p] == p:
			for i in range(p**2, n + 1, p):
				if ans[i] == i:
					ans[i] = p

	return ans

def get_pf(n, spf):
	ans = []

	while n > 1:
		ans.append(spf[n])
		n = int(n / spf[n])

	return ans

if __name__ == "__main__":
	line = input().split(" ")

	a, b = int(line[0]), int(line[1])

	# spf = get_spf(max(math.ceil(math.sqrt(a)), math.ceil(math.sqrt(b))))
	spf = get_spf(max(a, b))

	primes_a = set(get_pf(a, spf))
	primes_b = set(get_pf(b, spf))

	ans = []
	for e in primes_a:
		if e in primes_b:
			ans.append(e)

	print((1 + len(ans)))

# Optimized solution
import math

def is_prime(n):
	if n < 2: return False

	for i in range(2, math.ceil(math.sqrt(n))):
		if n % i == 0:
			return False

	return True

def get_pf(n):
	ans = [1]

	for p in range(2, math.ceil(math.sqrt(n))):
		while n % p == 0:
			n = int(n / p)
			ans.append(p)

	if n != 1:
		ans.append(n)

	return ans

if __name__ == "__main__":
	line = input().split(" ")

	a, b = int(line[0]), int(line[1])

	if a > b:
		a, b = b, a

	primes_a = set(get_pf(a))
	primes_b = set(get_pf(b))

	# if b % a == 0 and is_prime(a):
	# 	primes_a.add(a)
	# 	primes_b.add(a)

	ans = []
	for e in primes_a:
		if e in primes_b:
			ans.append(e)

	# print(ans)
	print((len(ans)))
# Original solution
import math

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

l = max(a, b)
s = min(a, b)

if s == 1:
    print((1))
else:
    while l % s > 0:
        n = s 
        s = l % s
        l = n
    
    a = [i for i in range(2, s+1) ]
    p =[]

    while True:
        prime = min(a)

        if prime > math.sqrt(s):
            break

        p.append(prime)

        i = 0
        while i < len(a):
            if a[i] % prime == 0:
                a.pop(i)
                continue
            i += 1

    for i in a:
        p.append(i)

    ans = 1
    for i in range(len(p)):
        if s % p[i] == 0:
            ans += 1

    print(ans)

# Optimized solution
def gcd(x, y):
    if y == 0: return x
    return gcd(y, x%y)

def factorize(n):
    i = 2
    factors = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            factors.append(i)
        i += 1
    if n > 1:
        factors.append(n)
    return factors


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

g = gcd(a, b)
ans = set(factorize(g))

print((len(ans)+1))
# Original solution
# 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を2と3以上の奇数で順次割っていくする（下から計算したら、素数判定は不要）
# 3. 2.の結果に含まれる数の種類の数＋１が答え

def main():
  a, b = list(map(int, input().split()))
  while b != 0: a, b = b, a % b #最大公約数を求める
  print((num_facto(a) + 1))  
  
def num_facto(n):
  ans = 0
  max_n = int(n ** 0.5) + 1
  if n == 1: return ans
  two_and_odds = [2] + [x for x in range(3, max_n, 2) if x ** 2 <= n]
  for cursor in two_and_odds:
    if n == 1: break
    if n % cursor == 0: ans += 1
    while n % cursor == 0: n = n // cursor
  if n != 1: ans += 1
  return ans

if __name__ == "__main__":
  main()


# Optimized solution
# 1. 最大公約数を求める(ユークリッドの互除法)
# 2. 最大公約数を2と3以上の奇数で順次割っていくする（下から計算したら、素数判定は不要）
# 3. 2.の結果に含まれる数の種類の数＋１が答え

def main():
  a, b = list(map(int, input().split()))
  while b != 0: a, b = b, a % b #最大公約数を求める
  print((num_facto(a) + 1))  
  
def num_facto(n):
  ans = 0
  if n == 1: return ans
  cursor = 2
  while cursor ** 2 <= n:
    if n == 1: break
    if n % cursor == 0: ans += 1
    while n % cursor == 0: n = n // cursor
    cursor = 3 if cursor == 2 else (cursor + 2)
  if n != 1: ans += 1
  return ans

if __name__ == "__main__":
  main()
# Original solution
a, b = [int(i) for i in input().split()]
small = min(a, b)
big = max(a, b)

import sys

if small == 1:
    print((1))
    sys.exit(0)

import math
table = [i for i in range(2, small + 1) if (i % 2 != 0)]
limit  = math.sqrt(small)
prime = [2]
while True:
    if len(table) == 0:
        break
    head = table.pop(0)
    if head > limit:
        break
    table = [v for v in table if v % head != 0]
    prime.append(head)
prime.extend(table)
cd = [p for p in prime if (small % p == 0) and (big % p == 0)]

print((len(cd) + 1))


# Optimized solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

a, b = list(map(int, input().split()))
_min, _max = min(a, b), max(a, b)
prime_factors = []
i = 2
while i ** 2 <= _min:
    ext = 0
    while _min % i == 0:
        ext += 1
        _min //= i
    if ext:
        prime_factors.append((i, ext))
    i += 1
if _min != 1:
    prime_factors.append((_min, 1))

ans = 1
for pf, _ in prime_factors:
    if _max % pf == 0:
        ans += 1
print(ans)
# Original solution
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

a, b = list(map(int,input().split()))
a_set = set()
for num, _ in factorization(a):
    a_set.add(num)
b_set = set()
for num, _ in factorization(b):
    b_set.add(num)
ans = a_set & b_set
if 1 not in ans:
    ans.add(1)
print((len(ans)))


# Optimized solution
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

a, b = list(map(int,input().split()))
a_list = [x[0] for x in factorization(a)]
b_list = [x[0] for x in factorization(b)]
ans = set(a_list) & set(b_list) | {1}
print((len(ans)))
# Original solution
def factorization(n):
    res = set()
    tmp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if tmp % i == 0:
            while tmp % i == 0:
                tmp //= i
            res.add(i)
    res.add(tmp)
    if not res:
        res.add(n)
    return res

a, b = list(map(int,input().split()))
ans = factorization(a) & factorization(b) | {1}
print((len(ans)))


# Optimized solution
def factorization(n):
    res = set()
    tmp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if tmp % i == 0:
            while tmp % i == 0:
                tmp //= i
            res.add(i)
    res.add(tmp)
    return res

a, b = list(map(int,input().split()))
ans = factorization(a) & factorization(b) | {1}
print((len(ans)))
# Original solution
A, B = list(map(int,input().split()))
ans = 1
if A % 2 == 0 and B % 2 == 0:
    ans += 1
    while A % 2 == 0 and B % 2 == 0:
        A /= 2
        B /= 2
if A % 3 == 0 and B % 3 == 0:
    ans += 1
    while A % 3 == 0 and B % 3 == 0:
        A /= 3
        B /= 3
if A % 5 == 0 and B % 5 == 0:
    ans += 1
    while A % 5 == 0 and B % 5 == 0:
        A /= 5
        B /= 5

i = 3
while 2*i + 1 <= A and 2*i + 1 <= B:
    k = 2*i + 1
    if k % 3 == 0 or k % 5 == 0:
        i += 1
        continue
    elif A % k == 0 and B % k == 0:
        ans += 1
        A /= k
        B /= k
        while A % k == 0 and B % k == 0:
            A /= k
            B /= k
        i += 1
    else:
        i += 1
print(ans)

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

def ssb(n):
    a = {1}
    while n % 2 == 0:
        a.add(2)
        n /= 2
    i = 3
    while i ** 2 <= n:
        if n % i == 0:
            a.add(i)
            n /= i
        else:
            i += 2
    if n != 1:
        a.add(n)
    return a

a = ssb(A)
b = ssb(B)

print((len(a&b)))
# Original solution
def yakusu(x):
    ans=[1]
    check=2
    while(x!=1):
        if(x%check==0):
            ans+=[check]
            while(x%check==0):
                x=x//check
        check+=1  
    return ans
def main():
    a,b = list(map(int,input().split()))	
    ans=0
    y1=yakusu(a)
    for i in y1:
        if b%i==0:
            ans+=1
    print(ans)

main()



# Optimized solution
def yakusu(x):
    ans=[1]
    check=2
    while(x!=1 and check <= int(x**0.5)+2):
        if(x%check==0):
            ans.append(check)
            while(x%check==0):
                x=x//check
        check+=1
    if x != 1:
      ans.append(x)
    return ans
def main():
    a,b = list(map(int,input().split()))	
    ans=0
    y1=yakusu(a)
    for i in y1:
        if b%i==0:
            ans+=1
    print(ans)
 
main()