let is_prime n =
  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 is_prime_inner n (int_of_float (floor (sqrt (float_of_int n))))

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

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

let solve n =
  List.fold_left (fun x y -> x + y) 0 (map (fun x -> if is_prime x then 1 else 0) (make_list 2 n))

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

  solve 999999