CodeEff/ECCO huggingface dataset:
# Original solution
A, B = list(map(int, input().split()))


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


a = make_divisors(A)
b = make_divisors(B)
L = []
for x in a:
    if x in b:
        L.append(x)

ans = 0
for l in L:
    flag = False
    for i in range(2, l):
        if l % i == 0:
            flag = True
            break
    if flag:
        continue
    ans += 1

print(ans)

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


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


def is_prime(p):
    if p == 1:
        return False
    for i in range(2, int(p ** 0.5) + 1):
        if p % i == 0:
            return False
    return True


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

g = gcd(A, B)
d = make_divisors(g)

ans = 1
for i in d:
    if is_prime(i):
        ans += 1

print(ans)
# Original solution
aa, bb = list(map(int, input().split()))
A = max(aa, bb)
B = min(aa, bb)


def get_max(a, b):
    while True:
        c = a % b
        if c == 0:
            return b
        a = b
        b = c


B = get_max(A, B)

temp = []
for i in range(1, B + 1):
    if B % i == 0:
        temp.append(i)

flag = [0] * len(temp)
count = len(temp)
for i in range(0, len(temp)):
    for j in range(i + 1, len(temp)):
        if flag[j] == 0:
            max_ = get_max(temp[i], temp[j])
            if max_ != 1:
                flag[j] = 1
                count -= 1

print(count)


# Optimized solution
aa, bb = list(map(int, input().split()))
A = max(aa, bb)
B = min(aa, bb)


def get_max(a, b):
    while True:
        c = a % b
        if c == 0:
            return b
        a = b
        b = c


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


B = get_max(A, B)
factors = factorize(B)

if len(factors) == 0:
    print((1))
else:
    count = 1
    for i in range(0, len(factors) - 1):
        if factors[i] != factors[i + 1]:
            count += 1
    print((count + 1))
# Original solution
import math

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

def decompose(n):
	result = []
	
	i = 2
	while i <= n:
		if n % i == 0:
			result.append(i)
			n //= i
		else:
			i += 1
	return result

def calc_gcm(a, b):
	if a > b:
		r = a % b
		a = r
	
	while a > 0:
		r = b % a
		b = a
		a = r
	
	return b

primes = decompose(calc_gcm(A, B))
count = 1
prev = 0
for p in primes:
	if prev != p:
		count += 1
	prev = p
print(count)


# Optimized solution
import math

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

def decompose(n):
	result = []
	
	i = 2
	n2 = math.floor(math.sqrt(n)) + 1
	while i <= n2:
		if n % i == 0:
			result.append(i)
			n //= i
			n2 = math.floor(math.sqrt(n)) + 1
		else:
			i += 1
	if n > 1:
		result.append(n)
	return result

def calc_gcm(a, b):
	if a > b:
		r = a % b
		a = r
	
	while a > 0:
		r = b % a
		b = a
		a = r
	
	return b

primes = decompose(calc_gcm(A, B))
count = 1
prev = 0
for p in primes:
	if prev != p:
		count += 1
	prev = p
print(count)
# Original solution
import sys
import math
import itertools
import collections
from collections import deque
 
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
 
NI = lambda: int(eval(input()))
NMI = lambda: list(map(int, input().split()))
NLI = lambda: list(NMI())
SI = lambda: eval(input())
 
def get_sieve_of_eratosthenes(n):
    if not isinstance(n, int):
        raise TypeError('n is int type.')
    if n < 2:
        raise ValueError('n is more than 2')
    prime = []
    limit = math.sqrt(n)
    data = [i + 1 for i in range(1, n)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

def main():
    A, B = NMI()
    GCD = math.gcd(A, B)
    
    if A == 1 or B == 1:
      print((1))
    else:
      
      cnt = 0
      for n in get_sieve_of_eratosthenes(GCD):
          if GCD % n == 0:
              cnt += 1
      print((cnt+1))

    
 
 
if __name__ == '__main__':
    main()

# Optimized solution
import sys
import math
import itertools
import collections
from collections import deque
 
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
 
NI = lambda: int(eval(input()))
NMI = lambda: list(map(int, input().split()))
NLI = lambda: list(NMI())
SI = lambda: eval(input())
 
def main():
    A, B = NMI()
    GCD = math.gcd(A, B)
    N=GCD
    
    cnt = 0
    
    ls=[]
    
    for n in range(2,int(N**0.5)+2):
 
        if GCD % n == 0:
            cnt += 1
 
            while GCD % n == 0:
                GCD = GCD//n
                ls.append(n)
        
    if GCD == 1:
        print((cnt+1))
    else:
        print((cnt+2)) 

if __name__ == '__main__':
    main()
# Original solution
import itertools

def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

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

    div_A = divisor(A)
    div_B = divisor(B)
    C = list(set(div_A) & set(div_B))
    cnt = 1
    for c in C:
        if is_prime(c):
            cnt += 1

    print(cnt)

main()

# Optimized solution
def divisor(n):
    ass = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            ass.append(i)
            if i**2 == n:
                continue
            ass.append(n//i)
    return ass 

def is_prime(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

def main():
    A, B = list(map(int, input().split()))
    div_A = set(divisor(A))
    div_B = set(divisor(B))
    div_list = list(div_A & div_B)
    cnt = 1
    for n in div_list:
        if is_prime(n):
            cnt += 1

    print(cnt)



if __name__ == "__main__":
    main()
# Original solution
def my_gcd(x, y):
    if x >= y:
        m = x
        n = y
    else:
        m = y
        n = x
    r = m % n
    while r:
        m = n
        n = r
        r = m % n
    return n

def _is_prime(n):
    for i in range(n - 1):
        if (i + 1) ** (n - 1) % n != 1:
            return False
    return True

a, b = list(map(int, input().split()))
g = my_gcd(a, b)
count = 1
num = g
d = 2
while num > 1:
    if _is_prime(d):
        flag = True
        while not num % d:
            if flag:
                count += 1
                flag = False
            num = num // d
    d += 1
print(count)

# Optimized solution
def prime_decomposition(n):
    i = 2
    result = []
    while i ** 2 <= n:
        while not n % i:
            result.append(i)
            n //= i
        i += 1
    if n > 1:
        result.append(n)
    return result

a, b = list(map(int, input().split()))
s = set(prime_decomposition(a))
t = set(prime_decomposition(b))
print((len(s & t) + 1))
# Original solution
a,b=list(map(int,input().split()))
def c(n):
  s=set([1])
  if n%2==0:
    s.add(2)
    while n%2==0:
      n//=2
  i=1
  while n>1:
    i+=2
    if n%i==0:
      s.add(i)
      while n%i==0:
        n//=i
  return s
s=c(a)
l=list(s)
for x in l:
  if b%x!=0:
    s.remove(x)
print((len(s)))

# Optimized solution
a,b=list(map(int,input().split()))
def p(n):
    a = set([1])
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a
s=p(a)
l=list(s)
for x in l:
  if b%x!=0:
    s.remove(x)
print((len(s)))
# Original solution
def gcd(x,y):
	while y!=0:
		x,y=y,x%y
	return x

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

k = []
r = gcd(a,b)
for i in range(1,r+1):
	if a % i == 0 and b % i == 0:
		if i % 2 != 0 or i == 2:
			k.append(i)

l = []
l.append(k[0])
ans = 1

for i in range(1,len(k)):
	flag = True
	for j in range(len(l)):
		if gcd(k[i],l[j]) != 1:
			flag = False
			break
	if flag:
		l.append(k[i])
		ans += 1

print(ans)


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

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

def gcd(x,y):
	while y!=0:
		x,y=y,x%y
	return x

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

#factorization(24)
## [[2, 3], [3, 1]]
##  24 = 2^3 * 3^1

g = gcd(a,b)
#gcd_list = make_divisors(g)
bunkai = factorization(g)

if len(bunkai) == 1 and bunkai[0][0] == 1:
	print((1))
else:
	print((len(bunkai) + 1 ))
# Original solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import math 
def main():
    A, B = list(map(int, readline().split()))
    def gcd(x, y):
        if not x%y:
            return y
        return gcd(y, x%y)
    
    def factorize(x):
        res = []
        for i in range(2, int(math.sqrt(x))+1):
            if x%i != 0:
                continue
            cnt = 0
            while x%i == 0:
                x //= i
                cnt += 1 
            res.append((i, cnt))
        if x != 1:
            res.append((x, 1))
        return res

    g = gcd(A, B)
    print((len(factorize(gcd(A, B)))+1)) 
if __name__ == '__main__':
    main()


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import math 
def main():
    A, B = list(map(int, readline().split()))
    def gcd(x, y):
        if not x%y:
            return y
        return gcd(y, x%y)
    
    def factorize(x):
        res = []
        for i in range(2, int(math.sqrt(x))+1):
            if x%i != 0:
                continue
            cnt = 0
            while x%i == 0:
                x //= i
                cnt += 1 
            res.append((i, cnt))
        if x != 1:
            res.append((x, 1))
        return res

    print((len(factorize(gcd(A, B)))+1)) 
if __name__ == '__main__':
    main()
# Original solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    A, B = list(map(int, readline().split()))
    def gcd(x, y):
        if not x%y:
            return y
        return gcd(y, x%y)
    
    def factorize(x):
        res = []
        i = 2
        while i*i <= x:
            if x%i != 0:
                continue
            cnt = 0
            while x%i == 0:
                x //= i
                cnt += 1 
            res.append((i, cnt))
            i += 1
        if x != 1:
            res.append((x, 1))
        return res

    print((len(factorize(gcd(A, B)))+1)) 
if __name__ == '__main__':
    main()


# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    A, B = list(map(int, readline().split()))
    def gcd(x, y):
        if not x%y:
            return y
        return gcd(y, x%y)
    
    def factorize(x):
        res = []
        for i in range(2, int(x**0.5)+1):
            if x%i != 0:
                continue
            cnt = 0
            while x%i == 0:
                x //= i
                cnt += 1 
            res.append((i, cnt))
        if x != 1:
            res.append((x, 1))
        return res

    print((len(factorize(gcd(A, B)))+1)) 
if __name__ == '__main__':
    main()
# Original solution
A,B=list(map(int,input().split()))
lst=set()
i=2
while i<=A or i<=B:
    #print(i,A,B,lst)
    if A%i==0 and B%i==0:
        flag=1
        for l in lst:
            if i%l==0:
                flag=0
                break

        if flag:
            lst.add(i)
        while A%i==0:
            A=A//i
        while B%i==0:
            B=B//i
    i+=1


lst.add(1)
#print(lst)
print((len(lst)))


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

if A==B==1:
    print((1))
else:
    print((len(set([i[0] for i in factorization(A)])&set([i[0] for i in factorization(B)]))+1))
# Original solution
import math


# 最大公约数
def zuidagongyueshu(x, y):
    if y % x == 0:
        return x

    if x % y == 0:
        return y

    if x < y:
        return zuidagongyueshu(y % x, x)
    else:
        return zuidagongyueshu(x % y, y)


# 分解质因数
# 30 = 2*3*5
# 60 = (2,2)*3*5
# 420 = (2,2)*3*5*7
# 1260 = (2,2)*(3,2)*5*7
# 6300 = (2,2)*(3,2)*(5,2)*7

container = []
def fenjiezhiyinshu(x):
    for i in range(1, x + 1):
        if i == 1:
            continue
        else:
            flag = False
            while x % i == 0:
                x = int(x / i)
                flag = True

            if flag:
                container.append(i)
                return fenjiezhiyinshu(x)

S = input().split(' ')
arr = list(map(int, list(S)))
fenjiezhiyinshu(zuidagongyueshu(arr[0],arr[1]))
print((len(container)+1))




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

def yinshufenjie(m):
    pf = {}
    for i in range(2, int(m ** 0.5) + 1):
        while m % i == 0:
            pf[i] = pf.get(i, 0) + 1
            m //= i
    if m > 1: pf[m] = 1
    return pf


def calculate(a,b):
    s1 = yinshufenjie(a)
    s2 = yinshufenjie(b)

    set1 = set()
    set2 = set()
    for key in list(s1.keys()):
        set1.add(key)

    for key in list(s2.keys()):
        set2.add(key)

    a = set1 & set2
    print((len(a)+1))


calculate(A,B)
# Original solution
def make_prime_factors_distinct(n: int) -> list:
    """自然数nの素因数(重複なし)を列挙したリストを出力する
    計算量: O(sqrt(N))
    入出力例: 156 -> [2, 3, 13]
    """
    prime_factors = []
    for k in range(2, int(n**0.5) + 1):
        if n % k == 0:
            prime_factors.append(k)
            while n % k == 0:
                n = n // k
    if n != 1:
        prime_factors.append(n)
    return prime_factors


def gcd(a: int, b: int) -> int:
    """a, bの最大公約数(greatest common divisor: GCD)を求める
    計算量: O(log(min(a, b)))
    """
    if b == 0:
        return a
    return gcd(b, a%b)


a, b = list(map(int, input().split())) 
res = gcd(a, b)
print((len(make_prime_factors_distinct(res)) + 1))

# Optimized solution
def make_prime_factors_compress(n: int):
    """自然数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 gcd(a: int, b: int) -> int:
    """a, bの最大公約数(greatest common divisor: GCD)を求める
    計算量: O(log(min(a, b)))
    """
    if b == 0:
        return a
    return gcd(b, a%b)


def lcm(a: int, b: int) -> int:
    """a, bの最小公倍数(least common multiple: LCM)を求める
    計算量: O(log(min(a, b)))
    """
    return (a * b) // gcd(a, b)

  
a, b = list(map(int, input().split()))
gcd_ = gcd(a, b)
print((len(make_prime_factors_compress(gcd_)) + 1))
# Original solution
a, b  = [int(i) for i in input().split()]
 
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
 
def sieve(n):
  is_prime = [True for _ in range(n+1)]
  is_prime[0] = False
  for i in range(2, n+1):
    if is_prime[i-1]:
      j = 2 * i
      while j <= n:
        is_prime[j-1] = False
        j += i
  table = [ i for i in range(1, n+1) if is_prime[i-1]]
  return is_prime, table
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a
m = gcd(a,b)
_, sosu = sieve(m)
print((1+len(set(sosu)&set(divisor(m)))))

# Optimized solution
# a, bを素因数分解する。O(ルートa + ルートb)
# 共通の素因数を見つける。O(loga + logb)

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

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_prime = set(prime_factorize(a))
b_prime = set(prime_factorize(b))
ans = 0
for ap in a_prime:
  for bp in b_prime:
    if ap == bp:
      ans += 1
      break
print((ans+1))
# Original solution
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return(a)


def make_divisors(n):
    divisors = []
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.append(n)
    return divisors


def pri(n):
    if n == 1:
        return 1

    for i in range(2, int(n/2 + 1)):
        if n % i == 0:
            return 0

    else:
        return 1


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

C = gcd(A, B)

d = make_divisors(C)
d.append(1)
d = list(set(d))

cnt = 0
for i in d:
    cnt += pri(i)

print(cnt)


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


def make_divisors(n):
    divisors = []
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.append(n)
    return divisors


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 = list(map(int, input().split()))

C = gcd(A, B)

d = prime_factorize(C)
d.append(1)

print((len(list(set(d)))))
# Original solution
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

A, B = list(map(int, input().split()))
if A > B:
    A, B = B, A
c = gcd(A, B)
ans = 1

for i in range(2, c+1):
    if i > c:
        break
    if c%i == 0:
        ans += 1
        while c%i == 0:
            c = c//i

print(ans)

# Optimized solution
from math import sqrt, ceil

# ユークリッドの互除法で最大公約数を返す
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

A, B = list(map(int, input().split()))
if A > B:
    A, B = B, A
g = gcd(A, B)
s = set(); s.add(1)
sqrt_g_plus = ceil(sqrt(g))+1
i = 2

# 最大公約数の平方根までの素数を見つける
while i < sqrt_g_plus:
    if g%i == 0:
        s.add(i)
        g //= i
    else:
        i += 1
# 平方根以上の素数がある場合、追加する（あるとした場合一つだけである）
if g > 1:
    s.add(g)

print((len(s)))
# Original solution
def make_divisors(n):
    from collections import deque
    divisors = deque([])
    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)
    lst_divisors = list(divisors)
    lst_divisors.sort()
    return lst_divisors

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

ya = set(make_divisors(a))
yb = set(make_divisors(b))

cand = list(ya&yb)
cand.sort()

#print(cand)

ans = []
if len(cand) > 1:
    for n in cand[1:]:
        if ans:
            for n in cand[1:]:
                for waru in ans:
                    if n%waru == 0:
                        break
                else:
                    ans.append(n)
        else:
            ans.append(n)
#print(ans)
print((len(ans)+1))

# Optimized solution
def make_divisors(n):
    from collections import deque
    divisors = deque([])
    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)
    lst_divisors = list(divisors)
    lst_divisors.sort()
    return lst_divisors

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

ya = set(make_divisors(a))
yb = set(make_divisors(b))

cand = list(ya&yb)
cand.sort()

#print(cand)

ans = []
if len(cand) > 1:
    for n in cand[1:]:
        if ans:
            for waru in ans:
                if n%waru == 0:
                    break
            else:
                ans.append(n)
        else:
            ans.append(n)
#print(ans)
print((len(ans)+1))
# Original solution
import math
def primes(n):
    l= []
    for i in range(2,math.floor(math.sqrt(n))):
        while n % i == 0:
            n = n//i
            l.append(i)
        if n == 1: 
            break
    
    if n > 1:
        l.append(n)
    return l

a,b=list(map(int,input().split()))
sa=set(primes(a))
sb=set(primes(b))
sans=sa.intersection(sb)
print((len(sans)+1))

# Optimized solution
def prime_factors(n):
    res = set()
    while n % 2 == 0:
        res.add(2)
        n //= 2
    i = 3
    while i * i <= n:
        if n % i == 0:
            res.add(i)
            n //= i
        else:
            i += 2
    if n != 1:
        res.add(n)
    return res

a, b = list(map(int, input().split()))
a = prime_factors(a)
b = prime_factors(b)
print((len(a & b) + 1))
# Original solution
def gcd(x,y):
    while y:
        x,y = y , x % y 
    return x

a,b=list(map(int,input().split()))
c=gcd(a,b)
ans = 1
div = 2
first_flag=1
while c>1:
    while c%div == 0:
        c /= div
        if first_flag == 1:
            ans += 1
            first_flag = 0 
    div += 1
    first_flag = 1
print(ans)

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

a,b=list(map(int,input().split()))
c=gcd(a,b)
ans = 1
div = 2
first_flag=1
while c>1:
    if  div**2 > c:
        ans +=1
        break
    while c%div == 0:
        c /= div
        if first_flag == 1:
            ans += 1
            first_flag = 0 
    div += 1
    first_flag = 1
print(ans)
# Original solution
A, B = list(map(int, input().split()))

def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

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

def coprime(a, b):
    return gcd(a, b) == 1

l = cf(A, B)
if len(l) == 0:
    print((1))
else:
    c = 1
    for i in range(len(l)):
        for j in range(i):
            if not coprime(l[i], l[j]):
                break
        else:
            c += 1
    print(c)

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

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

def coprime(a, b):
    return gcd(a, b) == 1

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

G = gcd(A, B)
l = make_divisors(G)
l.remove(1)
if len(l) == 0:
    print((1))
else:
    c = 1
    for i in range(len(l)):
        for j in range(i):
            if not coprime(l[i], l[j]):
                break
        else:
            c += 1
    print(c)