let () =
  let m = 1000000 in
  let a = Array.make m false in a.(0) <- true;
  let dp = Array.make m 0 in
  let rec aux i j =
    if i*j < m then (a.(i*j) <- true; aux i (j + 1))
  and make i =
    if i < m then begin
      if not a.(i) then aux i 2;
      dp.(i) <- dp.(i - 1) + (if a.(i) then 0 else 1);
      make (i + 1)
    end
  in
  make 2;
  let rec doit () =
    Printf.printf "%d\n" dp.(read_int ());
    doit ()
  in
  try doit() with _ -> ()