import java.io.InputStreamReader
import java.io.BufferedReader
import java.util.HashMap

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))

  br.readLine()

  val map = hashMapOf<Int, Int>()
  br.readLine().split(" ").map { it.toInt() }
    .forEach { key ->
      val v = map.getOrElse(key) {0}
      map.put(key, v + 1)
    }

  val ans = map.entries.fold(0L) { acc, entry ->
    val(k, v) = entry
    if(k > v) acc + v else acc + (v - k)
  }

  println(ans)
}