#9841: AC(pascal)


xcqzbzb (沈屌丝)


var
  a,b,i,c,j:longint;
  n:boolean;
begin
  while not eof do begin
    readln(a,b);
    c:=0;
    for i:=a to b do begin
      n:=true;
      if i<2 then begin
        n:=false;
        break;
      end;
      if i=2 then break;
      for j:=2 to trunc(sqrt(i)) do if (i mod j)=0 then begin
        n:=false;
        break;
      end;
      if n=true then c:=c+1;
    end;
    writeln(c);
  end;
  readln;
end.