program QinHeShu;
var
a,b,i,j,he,he1:longint;
s:integer;
begin
assign(input,'amicable.in');
reset(input);
assign(output,'amicable.out');
rewrite(output);
readln(a,b);
s:=0;
for i:=a to b do
begin
he:=0;
he1:=0;
for j:=1 to round(sqrt(i)) do
if i mod j=0 then
begin
he:=he+j+(i div j);
end;
he:=he-i;
if he<=i then continue;
for j:=1 to round(sqrt(he)) do
if he mod j=0 then
begin
he1:=he1+j+(he div j);
end;
if he1-he=i then
begin
s:=s+1;
end
end;
writeln(s);
close(input);
close(output)
end.