program qinheshu;
var
i,a,b,s,t,daiti,daiti2:longint;
procedure yinzihe(n:integer);
var
j:longint;
begin
t:=1;
for j:=2 to trunc(sqrt(n)) do
if n mod j=0 then
t:=t+j+n div j
end;
begin
assign (input,'amicable.in');
reset (input);
assign (output,'amicable.out');
rewrite (output);
read(a,b);
for i:=a to b do
begin
yinzihe(i);
daiti2:=i;
if (t<=b) and(t>i) then
begin
daiti:=t;
yinzihe(daiti);
if t=daiti2 then
s:=s+1
end
end;
write (s);
close (input);
close (output)
end.