let count_divisors n =
  let rec count_div_aux n k ret = match k with
    | k when n = k -> ret + 1
    | k when n mod k = 0 -> count_div_aux n (k+1) (ret+1)
    | _ -> count_div_aux n (k+1) ret
  in
  if n mod 2 = 0 then 0 else count_div_aux n 1 0

let eights n =
  let rec eights_aux n k ret = match (n, ret) with
    | (n, ret) when k > n -> ret
    | (n, ret) when (count_divisors k) = 8 -> eights_aux n (k+1) (ret+1)
    | _ -> eights_aux n (k+1) ret
  in
  eights_aux n 105 0

let () =
  let rec read () =
    try let ans = (Scanf.scanf "%d\n" eights) in
        Printf.printf "%d\n" ans
    with End_of_file -> ()
  in
  read ()
;;
