var
a,b,i,ans:longint;
function judge(x:longint):boolean;
var i,y,t:longint;
begin
y:=1;
for i:=2 to trunc(sqrt(x)) do
if x mod i=0 then y:=y+i+x div i;
if sqr(trunc(sqrt(x)))=x then y:=y-trunc(sqrt(x));
t:=1;
for i:=2 to trunc(sqrt(y)) do begin
if y mod i=0 then t:=t+i+y div i;
if t>x then exit(false);
end;
if sqr(trunc(sqrt(y)))=y then t:=t-trunc(sqrt(y));
if (t=x)and(x<y) then exit(true);
exit(false);
end;
Begin
assign(input,'amicable.in');
assign(output,'amicable.out');
reset(input);
rewrite(output);
readln(a,b);
ans:=0;
for i:=a to b do
if (i mod 2=0)or((i mod 2<>0)and(i mod 5=0)) then
if judge(i) then inc(ans);
writeln(ans);
close(input);
close(output);
end.