program P1417;
var
x,y,i,j,sum:longint;
function gcd(x,y:longint):longint;
begin
if x mod y=0 then exit(y) else gcd:=gcd(y,x mod y);
end;
begin
assign(input,'gcdpro.in');
reset(input);
assign(output,'gcdpro.out');
rewrite(output);
read(x,y);
for i:=x to y do
if (i mod x=0)and(y mod i=0) then
for j:=x to y do
if (j mod x=0)and(y mod j=0) then
begin
if (gcd(i,j)=x)and(i div gcd(i,j)*j=y) then inc(sum );
end;
writeln(sum);
end.