let rec range s t = if s > t then [] else s :: range (s + 1) t
                                                           
let sieve x lst = List.filter (fun i -> i mod x <> 0) lst

let rec primes = function
  | [] -> []
  | hd :: tl -> hd :: primes (sieve hd tl)
                              
let _ =
  try
    while true do
      let n = Scanf.scanf "%d\n" (fun x -> x) in
      let plst = primes (range 2 n) in
      Printf.printf "%d\n" (List.length plst)
    done
  with
    End_of_file -> ()