Scanf.scanf "%d %d %d" @@ fun n c k ->
  let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x)) in
  Array.sort (-) a;
  Array.fold_left (fun ((j, y), s) (i, x) ->
    if i-j < c && x-y <= k then ((j, y), s)
    else ((i, x), s+1)) ((0, a.(0)), 1) (Array.mapi (fun i e -> i, e) a)
  |> snd |> Printf.printf "%d\n"