open Batteries

module Counter = Map.Make(Int)

let solve xs =
  let update = function
    | None -> Some 1
    | Some i -> Some (i + 1)
  in let rec count counter = function
    | [] -> counter
    | h :: t -> Counter.modify_opt h update counter
  in let count_dict = count Counter.empty xs
  in let n_reduce i =
    let ni = Counter.find i count_dict in
    if i < ni then ni - i
    else if i = ni then 0
    else ni
  in BatEnum.map n_reduce (Counter.keys count_dict) |> BatEnum.sum |> print_int

let () =
  let _ = read_int () in
  let xs = read_line () |> String.split_on_char ' ' |> List.map int_of_string in
  solve xs
