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

plist = []

for i in range(2, int(g ** 0.5) + 1):
	if g % i == 0:
		plist.append(i)
		while(g % i == 0):
			g //= i
if g != 1:
	plist.append(g)

print(len(plist) + 1) from math import gcd A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B g = gcd(A, B) g gcd(A, B) gcd A B plist = [] plist [] for i in range(2, int(g ** 0.5) + 1):
	if g % i == 0:
		plist.append(i)
		while(g % i == 0):
			g //= i i range(2, int(g ** 0.5) + 1) range 2 int(g ** 0.5) + 1 int(g ** 0.5) int g ** 0.5 g 0.5 1 if g % i == 0:
		plist.append(i)
		while(g % i == 0):
			g //= i g % i == 0 g % i g i 0 plist.append(i) plist.append plist append i while(g % i == 0):
			g //= i g % i == 0 g % i g i 0 g //= i g i if g != 1:
	plist.append(g) g != 1 g 1 plist.append(g) plist.append plist append g print(len(plist) + 1) print len(plist) + 1 len(plist) len plist 1 g = gcd(A, B) gcd(A, B) g g //= i i g B = map(int, input().split()) map(int, input().split()) B plist = [] [] plist A, B = map(int, input().split()) map(int, input().split()) A
from math import gcd
A, B = map(int, input().split())
g = gcd(A, B)

plist = []

for i in range(2, int(g ** 0.5) + 1):
	if g % i == 0:
		plist.append(i)
		while(g % i == 0):
			g //= i
if g != 1:
	plist.append(g)

print(len(plist) + 1)