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

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


"""
最大公約数を素因数分解すればいけそう？
"""

target = gcd(a,b)
pftarg = pfact(target).items()
print(len(pftarg)+1) from fractions import gcd a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def pfact(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 pfact pf = {} pf {} for i in range(2,int(m**0.5)+1):
		while m%i == 0:
			pf[i] = pf.get(i,0) + 1
			m //= i
	 i range(2,int(m**0.5)+1) range 2 int(m**0.5)+1 int(m**0.5) int m**0.5 m 0.5 1 while m%i == 0:
			pf[i] = pf.get(i,0) + 1
			m //= i
	 m%i == 0 m%i m i 0 pf[i] = pf.get(i,0) + 1 pf[i] pf i pf.get(i,0) + 1 pf.get(i,0) pf.get pf get i 0 1 m //= i m i if m>1 : pf[m]=1
	 m>1 m 1 return pf pf m m """
最大公約数を素因数分解すればいけそう？
""" target = gcd(a,b) target gcd(a,b) gcd a b pftarg = pfact(target).items() pftarg pfact(target).items() (target).items (target) pfact target items print(len(pftarg)+1) print len(pftarg)+1 len(pftarg) len pftarg 1 def pfact(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 pfact(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 pfact target = gcd(a,b) gcd(a,b) target a,b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b pftarg = pfact(target).items() pfact(target).items() pftarg
from fractions import gcd
a,b = map(int,input().split())

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


"""
最大公約数を素因数分解すればいけそう？
"""

target = gcd(a,b)
pftarg = pfact(target).items()
print(len(pftarg)+1)