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() import math 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 prime_factorize ret = [] 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])
	 i range(2, int(n ** 0.5) + 1) range 2 int(n ** 0.5) + 1 int(n ** 0.5) int n ** 0.5 n 0.5 1 if n % i == 0:
			cnt = 0
			while n % i == 0:
				cnt += 1
				n = n // i
			ret.append([i, cnt])
	 n % i == 0 n % i n i 0 cnt = 0 cnt 0 while n % i == 0:
				cnt += 1
				n = n // i
			 n % i == 0 n % i n i 0 cnt += 1 cnt 1 n = n // i n n // i n i ret.append([i, cnt]) ret.append ret append [i, cnt] i cnt if n != 1:
		ret.append([n, 1])
	 n != 1 n 1 ret.append([n, 1]) ret.append ret append [n, 1] n 1 if len(ret) == 0:
		ret.append([n, 1])

	 len(ret) == 0 len(ret) len ret 0 ret.append([n, 1]) ret.append ret append [n, 1] n 1 return ret ret n n 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 int(x) for x in input().split(" ") for x in input().split(" ") x input().split(" ") ().split () input split " " for x in input().split(" ") int(x) int x A, B = [int(x) for x in input().split(" ")] A [int(x) for x in input().split(" ")] B g = math.gcd(A, B) g math.gcd(A, B) math.gcd math gcd A B pg = prime_factorize(g) pg prime_factorize(g) prime_factorize g if pg[0][0] == 1:
		print(1)
	else:
		print(len(pg) + 1) pg[0][0] == 1 pg[0][0] [0] pg 0 0 1 print(1) print 1 print(len(pg) + 1) print len(pg) + 1 len(pg) len pg 1 main() main 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) 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 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 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 prime_factorize
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()