var
xu,x,y,p,q,s:longint;
function gys(a,b:longint):longint;
begin
if a mod b=0 then gys:=b
else gys:=gys(b,a mod b);
end;
function gbs(a,b:longint):longint;
begin
gbs:=(a*b)div gys(a,b);
end;
begin
readln(x,y);
if x>y then xu:=x else xu:=y;
for p:=2 to xu do
for q:=2 to xu do
if (gys(p,q)=x)and(gbs(p,q)=y)then inc(s);
writeln(s);
end.
var
xu,x,y,p,q,s:longint;
function gys(a,b:longint):longint;
begin
if a mod b=0 then gys:=b
else gys:=gys(b,a mod b);
end;
function gbs(a,b:longint):longint;
begin
gbs:=(a*b)div gys(a,b);
end;
begin
readln(x,y);
if x>y then xu:=x else xu:=y;
for p:=2 to xu do
for q:=2 to xu do
if (gys(p,q)=x)and(gbs(p,q)=y)then inc(s);
writeln(s);
end.
n,m,l,i,x,y:longint;
function try(x1,y1:longint):boolean;
var
i,p,k:longint;
begin
try:=false;
if x1>y1 then p:=y1 else p:=x1;
k:=0;
for i:=1 to p do
if (x1 mod i=0)and(y1 mod i=0) then if i>k then k:=i;
if k=n then try:=true;
end;//在判断是否与n相等……
begin
readln(n,m);
l:=0;
for i:=n to n*m do
begin
if n*m mod i=0 then
begin
x:=i;
y:=n*m div i;
if try(x,y) then l:=l+1;
end;
end;//在枚举
write(l);
end.