program xmz;
var
f1,f2:text;
a,b,i,j,x,y,s:longint;
begin
assign(f1,'amicable.in');assign(f2,'amicable.out');
reset(f1);rewrite(f2);
read(f1,a,b);
for i:=a to b do
begin
y:=1;x:=1;
for j:=2 to round(sqrt(i)) do
if i mod j=0 then y:=y+j+(i div j);
if y>i then begin
for j:=2 to round(sqrt(y)) do
if y mod j=0 then x:=x+j+(y div j);
if i=x then begin s:=s+1; end;
end;
end;
write(f2,s);
close(f1);close(f2);
end.