open Batteries

module IntSet = Set.Make(Int)

let count e xs = Array.fold_left (fun a b -> if b = e then a + 1 else a) 0 xs

let solve xs =
  let set = IntSet.of_array xs in
  let n_reduce i =
    let ni = count i xs in
    if i < ni then ni - i
    else if i = ni then 0
    else ni in
  IntSet.fold (fun b a -> a + (n_reduce b)) set 0 |> print_int

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