program amicable;
var f:text;s,a,b:longint;
function js(x:longint):longint;
var t,i:longint;
begin
t:=1;
for i:=2 to trunc(sqrt(x)) do
if x mod i=0 then t:=t+i+(x div i);
js:=t
end;
procedure init;
begin
assign(f,'amicable.in');reset(f);
readln(f,a,b);close(f);
end;
procedure print;
begin
assign(f,'amicable.out');rewrite(f);
writeln(f,s);close(f);
end;
procedure main;
var i,k:longint;
begin
s:=0;
for i:=a to b do
begin
k:=js(i);
if k>i then if js(k)=i then s:=s+1;
end;
end;
begin
init;
main;
print;
end.