Given are positive integers A and B.
Let us choose some number of positive common divisors of A and B.
Here, any two of the chosen divisors must be coprime.
At most, how many divisors can we choose?Definition of common divisor
An integer d is said to be a common divisor of integers x and y when d divides both x and y.Definition of being coprime
Integers x and y are said to be coprime when x and y have no positive common divisors other than 1.Definition of dividing
An integer x is said to divide another integer y when there exists an integer \alpha such that y = \alpha x.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A, B \leq 10^{12}

-----Input-----
Input is given from Standard Input in the following format:
A B

-----Output-----
Print the maximum number of divisors that can be chosen to satisfy the condition.

-----Sample Input-----
12 18

-----Sample Output-----
3

12 and 18 have the following positive common divisors: 1, 2, 3, and 6.
1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.

Difficulty: interview

Starter code:

Solutions:
from math import gcd, sqrt
a,b = map(int, input().split())
g = gcd(a,b)
d = {}
for i in range(2, int(sqrt(g))+1):
    while g%i==0:
        g//=i
        d[i] = d.get(i, 0)+1
if g>1:
    d[g] = 1
print(len(d)+1)

import math

def factrize(num):
    factor = {}
    div = 2
    s = int(num**0.5)+1
    while div < s:
        div_cnt = 0
        while num % div == 0:
            div_cnt += 1
            num //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if num > 1:
        factor[num] = 1
    return factor

a, b = map(int, input().split())
g = math.gcd(a, b)
print(len(factrize(g))+1)

a,b=map(int,input().split())
 
def prime_factorization(n):
  if n==1:
    return [1]
  else:
    i=2
    ans=[]
    k=int(n**0.5)+1
    for j in range(2,k+1):
      if n==1: break
      if n%j==0:
        n//=j
        ans.append(j)
        while n%j==0:
          n//=j
    if len(ans):
      ans.append(1)
      if n!=1:
        ans.append(n)
      return ans
    else:
      return [1,n]

A=prime_factorization(a)
B=prime_factorization(b)
 
print(len(set(A)&set(B)))

from math import gcd

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 = map(int, input().split())
n = prime_factorize(gcd(a,b))

print(len(set(n))+1)

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

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

print((len(prime_factorization(gcd))+1))
#print(prime_factorization(gcd))


from math import gcd
from typing import List, Tuple


def pf(n: int) -> List[Tuple[int,int]]:
    r = []
    for p in range(2, n):
        if p * p > n:
            break
        e = 0
        if n % p == 0:
            while(n % p == 0):
                n //= p
                e += 1
            r.append((p, e))
    if n != 1:
        r.append((n, 1))
    return r

a,b = map(int, input().split())
apf = pf(a)
bpf = pf(b)
aps = {p for p,e in apf}
bps = {p for p,e in bpf}
print(len(aps&bps)+1)

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

import math
import collections

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

c = prime_factorize(math.gcd(A, B))
c = collections.Counter(c)
c = c.values()

print(len(c) + 1)

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

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

Aprimes = prime_factorization(A)
Bprimes = set(prime_factorization(B))

ans = 1
ansset = set()
for a in Aprimes:
    if a in ansset:
        continue
    if a in Bprimes:
        ansset.add(a)
        ans += 1

print(ans)



import math
ab = [int(i) for i in input().split()]
ab = math.gcd(ab[0], ab[1])
dic = {}
n = 2
while n**2 <= ab:
  if ab % n:
    n += 1
  else:
    ab //= n
    dic[n] = dic.get(n,0) + 1
if 1 < ab:
  dic[ab] = dic.get(ab,0) + 1

print(len(dic) + 1)

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

def prime_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)

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

setA=set(prime_factorization(A))
setB=set(prime_factorization(B))
setAB=setA &setB
if setAB=={1}:
    print(1)
else:
    print(len(setAB)+1)

def division(n):
    if n < 2:
        return [1]

    prime_factors = [1]

    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
    if n > 1:
        prime_factors.append(n)

    return prime_factors

a,b = map(int,input().split())
da = set(division(a))
db = set(division(b))
cnt = 0
for i in da:
    if i in db:
        cnt += 1
print(cnt)

import math


def factorization(n):
    arr = [1]
    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 not arr:
        arr.append(n)

    return arr


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

gcd = math.gcd(A, B)
f = factorization(gcd)
print((len(f)))


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
a, b = map(int, input().split())
n = gcd(a, b)
primes = []
MAX = 10 ** 6 + 10
is_prime = [False] * 2 + [True] * (MAX - 2)
for i in range(2, MAX):
    if is_prime[i]:
        primes.append(i)
        for j in range(i * i, MAX, i):
            is_prime[j] = False
cnt = 1
for p in primes:
    if n % p == 0:
        cnt += 1
        while n % p == 0:
            n /= p
if n != 1:
    cnt += 1
print(cnt)

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 = map(int, input().split())
x = gcd(a, b)
print(len(set(prime_factorize(x)))+1)

import math        # factorical（階乗) # hypot(距離)
# import heapq
# from fractions import gcd # Python3.5以前 # lcm（最小公倍数） = (a*b)//gcd(a,b)
# from fractions import Fraction
# from math import gcd # Python3.6以降
# --------------------------------------------------------------

# 素因数,個数 の組リストを出力
def fctr1(n): 
    f = []
    c = 0
    r = int(n**0.5)
    for i in range(2,r+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

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

print(len(fctr1(math.gcd(a,b)))+1)

a,b=map(int,input().split())
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
def factorize(x):
  i=2
  res=[]
  while i*i<=x:
    while x%i==0:
      x//=i
      res.append(i)
    i+=1
  if x>1:
    res.append(x)
  return res
g=gcd(a,b)
f=factorize(g)
print(len(set(f))+1)

import math
a,b = (int(x) for x in input().split())
saidai = 1

def yakusuu(x,y):
    return(y,x % y)

def cont(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

saidai = math.gcd(a,b)


d = cont(saidai)
if d[0] == [1,1]:
    print((1))
    return
print((len(d) + 1))


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

def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        while tmp%i==0:
            tmp//=i
            arr.append(i)
    if tmp!=1:
        arr.append(tmp)
    if arr==[]:
        arr.append(n)
    return list(set(arr))

ans=len(factorization(math.gcd(a,b)))
print(ans+1 if math.gcd(a,b)!=1 else 1)

from math import gcd
def division(n):
    if n < 2:
        return [1]
    prime_factors = [1]
    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
    if n > 1:
        prime_factors.append(n)
    return prime_factors

a,b = map(int,input().split())
d = set(division(gcd(a,b)))
print(len(d))

import math

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(pow(n,1/2))+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 = map(int,input().split())
gcd_num =math.gcd(A,B)

if gcd_num == 1:
    print(1)
else:
    print(len(factorization(gcd_num))+1)


url = "https://atcoder.jp//contests/abc142/tasks/abc142_d"

import math

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

def main():
    a, b = list(map(int, input().split()))
    abgcd = math.gcd(a, b)
    s = set(prime_factorize(abgcd))
    print((len(s)+1))

def __starting_point():
    main()

__starting_point()

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]

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_yakusu = make_divisors(A)
B_yakusu = make_divisors(B)
yakusu_set = set(A_yakusu) & set(B_yakusu)
yakusu_list = list(yakusu_set)
 
if max(yakusu_list) != 1:
    print((len(factorization(max(yakusu_list)))+1)) 
else:
    print((1))


n, m = map(int, 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 = sorted(list(set(table)))
    return table


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


s = set(divisor(n)).intersection(set(divisor(m)))

ans = 1
for ss in s:
    if len(prime_factorize(ss)) == 1:
        ans += 1

print(ans)

import math
a,b=map(int,input().split())
ans=[1]
c=math.gcd(a,b)
for i in range(2,int(c**(1/2))+1):
  if c%i==0:
    while c%i==0:
      c//=i
    ans.append(i)
if c!=1:
  ans.append(c)
print(len(ans))

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque

def gcd(a, b):
    """最大公約数"""
    a, b = (a, b) if a >= b else (b, a)
    if b == 0:
        return a
    return gcd(b, a % b)


def prime_factorization(x):
    """素因数分解"""
    import math
    re = []
    i = 2
    while x != 1:
        if x % i == 0:
            re.append(i)
            x //= i
        else:
            i += 1
            if i > math.sqrt(x):
                re.append(x)
                break
    return re


# from decorator import stop_watch
#
#
# @stop_watch
def solve(A, B):
    div = gcd(A, B)
    print((len(set(prime_factorization(div))) + 1))


def __starting_point():
    # S = input()
    # N = int(input())
    A, B = list(map(int, input().split()))
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    # print(prime_factorization(A))
    # print(prime_factorization(B))
    solve(A, B)

__starting_point()

import math
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 = map(int,input().split())
Af = factorization(A)
Bf = factorization(B)
As = set()
Bs = set()
for i in range(len(Af)):
    As.add(Af[i][0])
for j in range(len(Bf)):
    Bs.add(Bf[j][0])
if A == 1 and B ==1:
    print(1)
else:
    print(len(As & Bs)+1)

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

def prime_factorization(n):
  if n==1:
    return [1]
  else:
    i=2
    ans=[]
    k=int(n**0.5)+1
    for j in range(2,k+1):
      if n==1: break
      if n%j==0:
        n//=j
        ans.append(j)
        while n%j==0:
          n//=j
    if len(ans):
      ans.append(1)
      if n!=1:
        ans.append(n)
      return ans
    else:
      return [1,n]

A=prime_factorization(a)
B=prime_factorization(b)
#print(A)
#print(B)

print((len(set(A)&set(B))))




from math import gcd
def resolve():
    def prime_factorize(n):
        if 2 <= n < 4:
            return [n]
        res = []
        i = 2
        while i * i <= n:
            while n % i == 0:
                res.append(i)
                n //= i
            i += 1
        if n != 1:
            res.append(n)

        return set(res)

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

    g = gcd(a, b)
    ans = prime_factorize(g)
    print((len(ans) + 1))


def __starting_point():
    resolve()

__starting_point()

import math
#試し割法
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        factor.append(1)
        factor.append(n)
        return factor
    else:
        factor.append(1)
        factor.append(n)
        return factor
A,B=list(map(int,input().split()))
A_primes=trial_division(A)
B_primes=trial_division(B)
primes=[]
for p in A_primes:
  if p in B_primes:
    primes.append(B_primes.pop(B_primes.index(p)))
print((len(list(set(primes)))))


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

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

#素因数分解
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

t = factorization(gcd(a,b))
if t[0][0]==1:
    print((1))
    return
print((len(t)+1))
    


import  math

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


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

C = math.gcd(A, B)




print((len(set(prime_factorization(C))) + 1))



import math
a,b=map(int,input().split())
x=math.gcd(a,b)
bun=[0]*(int(math.sqrt(x)+1))
bun[1]=1
for i in range(2,len(bun)):
  while x%i==0:
    if bun[i]==0:
      bun[i]+=1
    x=x//i
ans=sum(bun)
if x>1:
  ans+=1
print(ans)  

import math
a,b=map(int,input().split())
gcd=math.gcd(a,b)

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

print(len(prime_factorization(gcd))+1)

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

#N以下の素数れっきょエラトステネス
def prime(N):
    lsprime = [0,0]+[1 for i in range(N-1)]
    lsprime2 = []
    for i in range(N+1):
        if lsprime[i] == 0:
            continue
        lsprime2.append(i)
        k = i
        while i <= N:
            lsprime[i] = 0
            i += k
    return lsprime2

#素因数分解
def prime2(N):
    arr = []
    temp = N
    setprime = set()
    for i in range(2, int(-(-N**0.5//1))+1):
        if temp%i==0:
            cnt=0
            setprime.add(i)
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
        setprime.add(temp)

    if arr==[]:
        arr.append([N, 1])

    return arr,setprime

_,setp = prime2(C)
print(len(setp)+1)

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

# 最大公約数（ユークリッドの互除法）
def gcd(A,B):
    while B!=0:
        A,B=B,A%B
    return A

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+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

print((len(factorization(gcd(a,b)))+1 if a!=1 and b!=1 else 1))
# print(gcd(a,b))
# print(factorization(gcd(a,b)))


a,b=map(int,input().split())
A=[1]
for i in range(2,int(a**0.5)+1):
    if a%i==0:
        while a%i==0:
            a//=i
        A.append(i)
if a>1:
    A.append(a)
B=[1]
for i in range(2,int(b**0.5)+1):
    if b%i==0:
        while b%i==0:
            b//=i
        B.append(i)
if b>1:
    B.append(b)
can=0
for i in A:
    if i in B:
        can+=1
print(can)

a,b = map(int,input().split())
sa = set()
sb = set()
i = 1
while i * i <= max(a,b):
    if a % i == 0:
        sa.add(i)
        sa.add(a//i)
    if b % i == 0:
        sb.add(i)
        sb.add(b//i)
    i += 1
s = sa & sb
s.remove(1)
for x in list(s):
    for y in list(s):
        if x == y:
            continue
        if y % x == 0:
            s.remove(y)
print(len(s) + 1)

from math import sqrt
from math import ceil
def prime_factorization(n):
    pfs = [1]
    i = 2
    for i in range(2, int(ceil(sqrt(n)))):
        while n % i == 0:
            pfs.append(i)
            n //= i
    if n > 0:
        pfs.append(n)
    return pfs


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


def bit_search(pfs):
    m = len(pfs)
    ds = set([])
    for i in range(1 << m):
        d = 1
        for j in range(m):
            if i & (1 << m) > 0:
                d *= pfs[m]
        ds.add(d)
    return ds

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

gcdab = gcd(a, b)
#print (gcdab)
pfsab = prime_factorization(gcdab)
#print (pfsab)
pfsabset =set(pfsab)
print (len(pfsabset))

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

A , B = ( int(x) for x in input().split() )

Gcd = gcd( A , B )
lo_cds = []
up_cds = []
i = 1
while i * i <= Gcd:
    if Gcd % i == 0:
        lo_cds.append(i)
        if Gcd // i != i:
            up_cds.append( Gcd // i )
    i += 1
Cds = lo_cds + up_cds[::-1]
# 1は必ず含まれるし素数判定の邪魔なので事前に省く。
Cds.pop(0)
i = 0


while i < len(Cds):
    j = i + 1
    while j < len(Cds):
        if Cds[j] % Cds[i] == 0:
            Cds.pop(j)
        else:    
            j += 1
    i += 1

print( len(Cds) + 1 )

#!/usr/bin/env python3

# input = stdin.readline


def main():
  A,B = list(map(int,input().split()))
  def primeLst(x):
    acc = []
    f = 2
    while f * f <= x:
      if x % f == 0:
        acc.append(f)
        x //= f
      else:
        f += 1
    if x != 1:
      acc.append(x)
    return acc
  a = set(primeLst(A))
  b = set(primeLst(B))
  if len(a) * len(b) == 0:
    ans = 1
  else:
    ans = len(a&b) + 1
  print(ans)
  return

def __starting_point():
  main()

__starting_point()

import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return list(map(int, input().split()))
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    a,b = i_map()

    def prime_decomposition(n):
        i = 2
        table = []
        while i * i <= n: # sqrt(n)で計算が済む
            while n % i == 0:
                n //= i
                table.append(i)
            i += 1
        if n > 1:
            table.append(n)
        return table

    a = set(prime_decomposition(a))
    b = set(prime_decomposition(b))
    print((len(a&b)+1))



def __starting_point():
    main()

__starting_point()

import math

A, B = [int(_) for _ in input().split()]
N = math.gcd(A, B)

ans = 1
for i in range(2, int(math.sqrt(N)+1) + 1):
    if N % i == 0:
        ans += 1
        while N % i == 0:
            N //= i
if N > 1:
    ans += 1
print(ans)


from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353
import numpy

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

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

c = math.gcd(A, B)
d = factorization(c)

if c > 1:
    print(len(d)+1)
else:
    print(1)

import math

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

c = math.gcd(a, b)
print(len(set(prime_factorize(c)))+1)

N,M= list(map(int,(input().split())))
"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

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_factorize(N)
b = prime_factorize(M)
c= set(a) & set(b)
print((len(c)+1))
## [[2, 3], [3, 1]] 
##  24 = 2^3 * 3^1


import math

a,b = map(int, input().split())
t = math.gcd(a,b)

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

cnt = len(set(prime_decomposition(t)))

print(cnt+1)

# 問題：https://atcoder.jp/contests/abc142/tasks/abc142_d

import math

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


def count_prime_factorize(n):
    res = 1
    i = 2
    while i ** 2 <= n:
        if n % i == 0:
            res += 1
            while n % i == 0:
                n //= i
        i += 1
    if n != 1:
        res += 1
    return res


a, b = list(map(int, input().strip().split()))
x = gcd(a, b)
res = count_prime_factorize(x)
print(res)



def factrization(n):
    arr = []
    temp = n
    
    for i in range(2, int(n**0.5//1) + 2):
        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 == []:
        arr.append(n)
    
    return arr

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

la = factrization(a)
lb = factrization(b)

if 1 not in la:
    la.append(1)
if 1 not in lb:
    lb.append(1)

for i in la:
    if i in lb:
        ans += 1

print(ans)

from math import gcd
a, b = map(int, input().split())
x = gcd(a,b)
cnt = 1
for i in range(2, int(x ** 0.5) + 1):
        if x == 1:
            break
        if x % i == 0:
            cnt += 1
            while x % i == 0:
                x //= i
else:
    if x != 1:
        cnt += 1
print(cnt)

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

def gcd(a, b):
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b)

p = gcd(a, b)
factors = {}

while p > 1:
    f = False
    for i in range(2, int(p**0.5)+1):
        if p % i == 0:
            if i in factors:
                factors[i] += 1
            else:
                factors[i] = 1

            p //= i
            f = True
            break

    if not f:
        if p in factors:
            factors[p] += 1
        else:
            factors[p] = 1
        break

print(len(factors)+1)

def main():
    import math
    a,b = list(map(int,input().split()))
    g = math.gcd(a,b)
    ans = [1]
    for m in range(2,int(g**0.5)+1):
        if g%m==0:
            ans.append(m)
            while g%m==0:
                g = g//m
        if g==1:
            break
    if g!=1:
        ans.append(g)
    print((len(ans)))

def __starting_point():
    main()

__starting_point()

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

def fact(x):
	temp = x
	arr = [1]
	for i in range(2, int(math.sqrt(x))):
		if temp % i == 0:
			c = 0
			while temp % i == 0:
				c += 1
				temp //= i
			arr.append(i)
	if temp != 1:
		arr.append(temp)
	if arr == []:
		arr.append(n)
	return arr

a = fact(A)
b = fact(B)
ans = 0
for i in a:
	if i in b:
		ans += 1


print(ans)


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

import math
g = math.gcd(a,b)

"""
gを素因数分解したときの素因数のリストの要素数 + 「1」を含める

g == 1のとき
1
g != 1のとき
素因数リストの要素数 +1
"""



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


gdlist = prime_factorize(g)
if gdlist ==[]:
    print(1)
else:
    print(len(set(gdlist))+1)

# 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))


import math
a,b=map(int,input().split())
def factorize(x):
  i=2
  res=[]
  while i*i<=x:
    while x%i==0:
      x//=i
      res.append(i)
    i+=1
  if x>1:
    res.append(x)
  return res
g=math.gcd(a,b)
f=factorize(g)
print(len(set(f))+1)

import math

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

n=math.gcd(a,b)

cnt=1

f=2
d=n
while f*f<=n:
    if d%f==0:
        cnt+=1
        while d%f==0:
            d=d//f
    f+=1
if d!=1:
    cnt+=1

print(cnt)

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 = 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)

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

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

#nを素因数分解したリストを返す
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

print((len(factorization(gcd(a,b)))+1 if gcd(a,b)!=1 else 1))


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

from math import gcd

a, b = map(int,input().split())
g = gcd(a,b)
if g == 1:
    print(1)
else:
    print(len(factorization(g))+1)

import math

def prime_factorize(n):
	ret = []
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			cnt = 0
			while n % i == 0:
				cnt += 1
				n = n // i
			ret.append([i, cnt])
	if n != 1:
		ret.append([n, 1])
	if len(ret) == 0:
		ret.append([n, 1])

	return ret

def main():
	A, B = [int(x) for x in input().split(" ")]
	g = math.gcd(A, B)
	pg = prime_factorize(g)
	if pg[0][0] == 1:
		print(1)
	else:
		print(len(pg) + 1)

main()

from math import gcd,sqrt,floor
a,b = map(int,input().split())
c = gcd(a,b)
x = []
for i in range(1,floor(sqrt(c))+1):
    if c % i == 0:
        x.append(i)
        x.append(c//i)
x.sort()
y = []
i = 1
while c > 1 and i < len(x):
    if c % x[i] == 0:
        y.append(x[i])
        c = c // x[i]
    else:
        i += 1
print(len(set(y))+1)

a,b=map(int,input().split())
def 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 set(a)
print(len(factorize(a)&factorize(b))+1)

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

def prime_factorization(n):
  i=2
  prime=[]
  while i*i<=n and n>1:
    if n%i:
      i+=1
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
  if n>1:
    prime.append(n)
  return prime

print((len(prime_factorization(gcd))+1))
#print(prime_factorization(gcd))


import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def get_primenumber(number):#素数列挙
    prime_list = []
    search_list = list(range(2,number+1))
    #search_listの先頭の値が√nの値を超えたら終了
    while search_list[0] <= math.sqrt(number):
      #search_listの先頭の値が√nの値を超えたら終了
      #search_listの先頭をprime_listに入れて、先頭をリストに追加して削除
        head_num = search_list.pop(0)
        prime_list.append(head_num)
        #head_numの倍数を除去
        search_list = [num for num in search_list if num % head_num != 0]
    #prime_listにsearch_listを結合
    prime_list.extend(search_list)
    return prime_list
def factrization_prime(number):#素因数分解
    factor = {}
    div = 2
    s = math.sqrt(number)
    while div < s:
        div_cnt = 0
        while number % div == 0:
            div_cnt += 1
            number //= div
        if div_cnt != 0:
            factor[div] = div_cnt
        div += 1
    if number > 1:
        factor[number] = 1
    return factor
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
num = []
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

a,b = I()
prime_a = factrization_prime(a)
prime_b = factrization_prime(b)

for i in prime_a.keys():
    if i in prime_b.keys():
        cnt += 1

print(cnt+1)

a,b=list(map(int,input().split()))
if a==1 and b==1:
  print((1))
  return
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
ans=0
A=factorization(a)
B=factorization(b)
for i in A:
  for j in B:
    if i[0]==j[0]:
      ans+=1
print((ans+1))


import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():


    def prime_factor(n):
        lst = []
        while n%2 == 0:
            n //= 2
            lst.append(2)
        f = 3
        while f**2 <= n:
            if n%f == 0:
                n //= f
                lst.append(f)
            else:
                f += 2
        if n != 1:
            lst.append(n)
        return lst


    a, b = LI()
    g = math.gcd(a, b)

    prm = prime_factor(g)

    ans = len(set(prm)) + 1

    print(ans)

main()


import math 
def using_sqrt(k):  
    factor = 0
        
    # 2以外の偶数は素数ではないので無視する
    if k % 2 == 0 and k != 2:
        return False
        
    # 繰り返しの上限を対象の平方根にする
    for divisor in range(2, math.floor(math.sqrt(k))+1):
        if k % divisor == 0:
            factor += 1
                
    if factor == 0:
        return True
    else:
        return False
            
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 make_codivisors(n):
    divisors = []
    n0divisors = make_divisors(n[0])
    n0len = len(n0divisors)
    for i in n0divisors:
        for j in range(1, len(n)):
            if n[j] % i != 0:
                break
            if j == len(n)-1:
                divisors.append(i)
            
    # divisors.sort()
    return divisors

a, b =map(int, input().split())
div = make_codivisors([a, b])
ans = 0
for i in div:
  if i==1:
    ans+=1
  else:
    if using_sqrt(i):
      ans+=1
print(ans)

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

def factorization(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

s_a=set(factorization(a))
s_b=set(factorization(b))
ans_arr=s_a&s_b
print(len(ans_arr)+1)

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

def prime_decomposition(x):
  i = 2
  ls = []
  while i * i <= x:
    while x % i == 0:
      x /= i
      ls.append(i)
    i += 1
  if x > 1:
    ls.append(x)
  return ls

cnt = len(set(prime_decomposition(x)))

print(cnt+1)

from math import gcd
from typing import List, Tuple


def pf(n: int) -> List[Tuple[int,int]]:
    r = []
    for p in range(2, n):
        if p * p > n:
            break
        e = 0
        if n % p == 0:
            while(n % p == 0):
                n //= p
                e += 1
            r.append((p, e))
    if n != 1:
        r.append((n, 1))
    return r

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


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

def gcd(a,b):
    if a<b:a,b=b,a
    if b==0:return a
    while b>0:
        r=a%b
        a=b
        b=r
    return a
g=gcd(a,b)
x=g
s=set()
for i in range(2,int(math.sqrt(g))+1):
    while x%i==0:
        s.add(i)
        x/=i
if x!=1:s.add(x)
print(len(s)+1)

def factorize(n):
    fct = []
    b,e = 2,0
    while b*b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.append((b,e))
        b,e = b+1,0
    if n > 1:
        fct.append((n,1))
    return fct
a,b = map(int,input().split())
ap = set()
for prime,count in factorize(a):
    ap.add(prime)
bp = set()
for prime,count in factorize(b):
    bp.add(prime)
print(len(ap&bp)+1)

import math


def factorize(n):
    V = [1]
    if n == 1:
        return V

    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            V.append(i)
            while n % i == 0:
                n //= i
    if n > 1:
        V.append(n)
    return V


A, B = [int(x) for x in input().split()]
V = factorize(math.gcd(A, B))
print((len(V)))


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


def prime_numbers(N):
    n = N
    res = set()
    for i in range(2, n):
        if i * i >= n: break
        if N % i != 0: continue
        while N % i == 0:
            N //= i
        res.add(i)
    res.add(N)
    res.add(1)
    return res


a = prime_numbers(A)
b = prime_numbers(B)
#print(a, b)
#print(a.intersection(b))
ans = len(a.intersection(b))
print(ans)


# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# import heapq
# from collections import deque

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
A, B = map(int, input().split())
# A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

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
    
facts_A = factorization(A)

cnt = 0
for l in facts_A:
    if B % l[0] == 0:
        cnt += 1
print(cnt + 1)

import math
import collections

def prime_factorize(n):
    s = []
    while n % 2 == 0:
        s.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            s.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        s.append(n)
    return s

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

g = math.gcd(a, b)
c = collections.Counter(prime_factorize(g))

print(len(c.values()) + 1)

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(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: 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) 

def __starting_point():
    main()
__starting_point()

import math

a,b = map(int,input().split())
x = math.gcd(a,b)
s = [1]
for i in range(2,int(math.sqrt(x)+1)):
    if x%i == 0:
        while x%i == 0:
            x //= i
        s.append(i)
if x != 1:
    s.append(x)
l = len(s)
print(l)

# -*- coding: utf-8 -*-
"""
Created on Sun Sep 13 14:18:02 2020

@author: liang
"""

import math
from math import gcd
A, B = map(int,input().split())
g = gcd(A,B)
n = int(math.sqrt(g))
d_list = list()# 1

#約数チェック O(√n)
for i in range(1,n+1):
    if g % i == 0:
        j = g//i
        d_list.append(i)
        if j != 1:
            d_list.append(j)
d_list.sort()
#print(d_list)
ans_list = [1]
d_list.pop(0)
while d_list:
    t = d_list.pop(0)
    ans_list.append(t)
    d_list = [i for i in d_list if i%t != 0]
#print(d_list)
#print(ans_list)
print(len(ans_list))

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

# 最大公約数（ユークリッドの互除法）
def gcd(A,B):
    while B!=0:
        A,B=B,A%B
    return A

# 素因数分解
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

print((len(factorization(gcd(a,b)))+1 if a!=1 and b!=1 else 1))
# print(gcd(a,b))
# print(factorization(gcd(a,b)))


### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest
import collections

def yn(b):
    print(("Yes" if b==1 else "No"))
    return

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

def resolve():
    readline=sys.stdin.readline
    a,b=list(map(int, readline().rstrip().split()))

    af = factorization(a)
    bf = factorization(b)

    c = collections.Counter()
    c[1]=2
    for x in af:
        c[x[0]]+=1
    for x in bf:
        c[x[0]]+=1
    ans=0
    for k in list(c.keys()):
        if c[k]>=2:
            ans+=1
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    return

### ----------------
### ここまで 
### ----------------


import math
a,b=map(int,input().split())
gcd=math.gcd(a,b)

def prime_factorization(n):
  i=2
  prime=[]
  if n%i==0:
    n//=i
    prime.append(2)
    while n%i==0:
      n//=i
  i+=1
  k=int(n**0.5)+1
  for j in range(i,k+1,2):
    if n%j==0:
      n//=j
      prime.append(j)
      while n%j==0:
        n//=j
  if n>1:
    prime.append(n)
  return prime

print(len(prime_factorization(gcd))+1)

import math
a,b = map(int,input().split())
gcd = math.gcd(a,b)
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)))+1)

import math
A, B = map(int, input().split())
gcd = math.gcd(A, B)
ans = [1]
while gcd % 2 == 0:
  ans.append(2)
  gcd = gcd // 2
f = 3
while f * f <= gcd:
  if gcd % f == 0:
    ans.append(f)
    gcd = gcd // f
  else:
    f += 2
if gcd != 1:
  ans.append(gcd)
print(len(set(ans)))

import math


def main():
    a, b = list(map(int, input().split()))
    gcd = math.gcd(a, b)
    ans = [1]
    while gcd % 2 == 0:
        ans.append(2)
        gcd = gcd // 2
    f = 3
    while f * f <= gcd:
        if gcd % f == 0:
            ans.append(f)
            gcd = gcd // f
        else:
            f += 2
    if gcd != 1:
        ans.append(gcd)
    print((len(set(ans))))


def __starting_point():
    main()

__starting_point()

import math
#https://qiita.com/snow67675476/items/e87ddb9285e27ea555f8
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 = map(int,input().split())
g = math.gcd(a,b)
if g==1:
    print(1)
else:
    yakusu = factorization(g)
    print(len(yakusu)+1)

import math
def gcd(a,b):
    if a==0: return b
    return gcd(b%a,a)
def div(n):
    cnt = 0
    temp = n
    for i in range(2,int(math.sqrt(n))+1):
        if temp%i==0:
            while temp%i==0:
                temp //= i
            cnt += 1
    if temp!=1:
        cnt+=1
    return cnt+1

a,b = map(int,input().split())
print(div(gcd(a,b)))

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

def prime_factorization(n):
  i=2
  prime=[]
  while i*i<=n:
    if n==1: break
    if n%i:
      i+=1
    else:
      n//=i
      prime.append(i)
      while n%i==0:
        n//=i
  if n>1:
    prime.append(n)
  return prime

print((len(prime_factorization(gcd))+1))
#print(prime_factorization(gcd))


import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def factorization(num):
    prime = []
    n = num
    p = 2
    while p * p <= num:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            prime.append((p, cnt))
        p += 1
    if n != 1:
        prime.append((n, 1))
    if not prime:
        prime.append((num, 1))
    return prime

def Main():
    a, b = read_ints()
    g = GCD(a, b)
    if g == 1:
        print(1)
        return
    prime = factorization(g)
    print(len(prime)+1)

def __starting_point():
    Main()
__starting_point()

import sys
import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def factorization(num):
    prime = []
    n = num
    p = 2
    while p * p <= num:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            prime.append((p, cnt))
        p += 1
    if n != 1:
        prime.append((n, 1))
    if not prime:
        prime.append((num, 1))
    return prime

def Main():
    a, b = read_ints()
    g = math.gcd(a, b)
    if g == 1:
        print(1)
        return
    prime = factorization(g)
    print(len(prime)+1)

def __starting_point():
    Main()
__starting_point()

from math import gcd
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]

v = gcd(a,b) # greatest common divisors
divs = make_divisors(v)

k = 1
ans = 0
for d in divs:
    test = gcd(k, d)
    if test == 1:
        ans += 1
        k *= d
print(ans)


from math import *
g = gcd(*map(int,input().split()))
D = {}
n = 2

while n*n<=g:
  if g%n:
    n+=1
  else:
    g//=n
    D[n]=D.get(n,0)+1

if 1<g:
  D[g]=D.get(g,0)+1

print(len(D)+1)

a,b = 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 = set(prime_factorize(a))
B = set(prime_factorize(b))

cnt = 0
for i in A:
    if i in B:
        cnt += 1
print(cnt+1)

def factorize(n):
    fct = set()
    b,e = 2,0
    while b*b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.add(b)
        b,e = b+1,0
    if n > 1:
        fct.add(n)
    return fct
a,b = map(int,input().split())
print(len(factorize(a)&factorize(b))+1)

from functools import lru_cache

def main():
    a,b=map(lambda x: set(prime_factorize(int(x))),input().split())
    print(len(a&b)+1)

@lru_cache(maxsize=None)
def primes(n:int) -> list:
    '''n以下の全素数をlistで返す'''
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

# 素数判定（単純な素数判定なら十分早い。大量にやる場合はX in primesがよさそう）
@lru_cache(maxsize=None)
def is_prime(n: int) -> bool:
    '''引数nが素数であればTrue、そうでなければFalseを返す'''
    if n == 1:
        return False
    elif n == 2:
        return True
    elif n % 2 == 0:
        return False
    
    for i in range(3, int(n**0.5)+1, 2):
        if n % i == 0:
            return False
    return True

# 素因数分解
@lru_cache(maxsize=None)
def prime_factorize(n: int) -> list:
    '''引数nの素因数分解結果のlistを返す。'''
    arr = []
    # 2で割り続け奇数まで還元する
    while n % 2 == 0:
        arr.append(2)
        n //= 2
    # sqrt(n)までの素数で試し割
    for f in primes(int(n**0.5)):
        while n % f == 0:
            arr.append(f)
            n //= f
    if n != 1:
        arr.append(n)
    return arr

#約数リスト
def make_divisors(n: int) -> list:
    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]
        
def __starting_point():
    main()
__starting_point()

from math import gcd
A, B = map(int, input().split())
def factorize(n):
    arr = []
    temp = n
    for i in range(2, int(n**0.5)+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

n = gcd(A, B)
ans = factorize(n)
if ans[0][0] == 1:
    print(1)
    return
print(len(ans)+1)

a,b=map(int,input().split())
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
def factorize(x):
  i=2
  res=[]
  while i*i<=x:
    while x%i==0:
      x//=i
      res.append(i)
    i+=1
  if x>1:
    res.append(x)
  return res
g=gcd(a,b)
f=factorize(g)
print(len(set(f))+1)

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

gcd = math.gcd(A,B)
d = []
if A == 1 or B == 1 :
    print((1))
    return
ans = [1]
while gcd %2 == 0 :
    gcd //= 2
    ans.append(2)
i = 3
while i * i <= gcd :
    if gcd %i == 0 :
        ans.append(i)
        gcd //= i
    else :
        i += 2
if gcd != 1 :
    ans.append(gcd)
print((len(set(ans))))


import math
a, b = map(int, input().split())
gcd = math.gcd(a,b)

def fctr1(n):
    f=[]
    c=0
    r=int(n**0.5)
    for i in range(2,r+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

print(len(fctr1(gcd))+1)