module Cache = struct
  let create size = Array.make size None
                                 
  let find_or_add tbl n f =
    match tbl.(n) with
    | Some v -> v
    | None -> 
       let v = f n in
       tbl.(n) <- Some v;
       v
end

let is_prime n memo =
  let rec is_prime_inner n r =
    match r with
      1 -> true
    | _ -> 
       match n mod r with
         0 -> false
       | _ -> is_prime_inner n (r-1)
  in
  match memo.(n) with
  | Some v -> v
  | None ->
     let a = is_prime_inner n (int_of_float (floor (sqrt (float_of_int n)))) in
     memo.(n) <- Some a;
     a

let make_list f t step =
  let rec make_list_inner c t lst =
    if c >= t then lst else make_list_inner (c+step) t (c::lst)
  in
  make_list_inner f t []

let map f l = List.rev (List.rev_map f l)

let solve = function
  | 1 -> 0
  | 2 -> 1
  | n ->
     let memo = Cache.create 1000000 in
     List.fold_left (fun x y -> x + y) 0 (map (fun x -> if is_prime x memo then 1 else 0) (make_list 3 n 2))

let () =
  let rec read () =
    try let n = read_int() in
        Printf.printf "%d\n" (solve n);
        read ()
    with End_of_file -> ()
  in read ()
;;