import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val a = (1..n).map { sc.nextInt() }

  val map = mutableMapOf<Int, Int>()
  for (ai in a) {
    val tmp = map.getOrElse(ai) { 0 }
    map.put(ai, tmp+1)
  }

  var count = 0L
  for (mi in map) {
    val key = mi.key
    val value = mi.value
    if (key > value) {
      count += value
      continue
    }
    count += value - key
  }

  println(count)
}