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

g=fractions.gcd(a,b)
org=g
counter=1
for i in range(2,int(g**0.5)+1):
	if g%i == 0:
		counter += 1
		g //= i
		while g % i ==0:
			g //= i

if g > int(org ** 0.5):
	counter += 1

print(counter)
 import fractions fractions a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b g=fractions.gcd(a,b) g fractions.gcd(a,b) fractions.gcd fractions gcd a b org=g org g counter=1 counter 1 for i in range(2,int(g**0.5)+1):
	if g%i == 0:
		counter += 1
		g //= 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:
		counter += 1
		g //= i
		while g % i ==0:
			g //= i g%i == 0 g%i g i 0 counter += 1 counter 1 g //= i g i while g % i ==0:
			g //= i g % i ==0 g % i g i 0 g //= i g i if g > int(org ** 0.5):
	counter += 1 g > int(org ** 0.5) g int(org ** 0.5) int org ** 0.5 org 0.5 counter += 1 counter 1 print(counter) print counter b=map(int,input().split()) map(int,input().split()) b counter=1 1 counter counter += 1 1 counter g //= i i g a,b=map(int,input().split()) map(int,input().split()) a g //= i i g g=fractions.gcd(a,b) fractions.gcd(a,b) g counter += 1 1 counter org=g g org
import fractions
a,b=map(int,input().split())

g=fractions.gcd(a,b)
org=g
counter=1
for i in range(2,int(g**0.5)+1):
	if g%i == 0:
		counter += 1
		g //= i
		while g % i ==0:
			g //= i

if g > int(org ** 0.5):
	counter += 1

print(counter)

