from fractions import gcd

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

gcd=gcd(a,b)
ab_gcd=gcd

f=[]
for i in range(2,int(ab_gcd**0.5)+1):
    while gcd%i==0:
        gcd=gcd//i
        f.append(i)
if gcd!=1:
    f.append(gcd)

print(len(set(f))+1) from fractions import gcd a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b gcd=gcd(a,b) gcd gcd(a,b) gcd a b ab_gcd=gcd ab_gcd gcd f=[] f [] for i in range(2,int(ab_gcd**0.5)+1):
    while gcd%i==0:
        gcd=gcd//i
        f.append(i) i range(2,int(ab_gcd**0.5)+1) range 2 int(ab_gcd**0.5)+1 int(ab_gcd**0.5) int ab_gcd**0.5 ab_gcd 0.5 1 while gcd%i==0:
        gcd=gcd//i
        f.append(i) gcd%i==0 gcd%i gcd i 0 gcd=gcd//i gcd gcd//i gcd i f.append(i) f.append f append i if gcd!=1:
    f.append(gcd) gcd!=1 gcd 1 f.append(gcd) f.append f append gcd print(len(set(f))+1) print len(set(f))+1 len(set(f)) len set(f) set f 1 ab_gcd=gcd gcd ab_gcd b=map(int,input().split()) map(int,input().split()) b gcd=gcd(a,b) gcd(a,b) gcd f=[] [] f gcd=gcd//i gcd//i gcd a,b=map(int,input().split()) map(int,input().split()) a
from fractions import gcd

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

gcd=gcd(a,b)
ab_gcd=gcd

f=[]
for i in range(2,int(ab_gcd**0.5)+1):
    while gcd%i==0:
        gcd=gcd//i
        f.append(i)
if gcd!=1:
    f.append(gcd)

print(len(set(f))+1)
