program amicable;
var
a,b,s,i:longint;
procedure p(n:longint);
var
j,s2,s3:longint;
begin
s2:=0;
s3:=0;
for j:=1 to n div 2 do
if n mod j=0 then s2:=s2+j;
if s2>n then begin
for j:=1 to s2 div 2 do
if s2 mod j=0 then s3:=s3+j;
if s3=n then s:=s+1;
end;
end;
begin
assign(input,'amicable.in');
assign(output,'amicable.out');
reset(input);
rewrite(output);
readln(a,b);
s:=0;
for i:=a to b do
p(i);
writeln(s);
close(input);
close(output);
end.