fun main(arr:Array<String>) {
    val n = readLine()!!.toInt()
    val suretu = readLine()!!.split(" ").map { it.toLong() }
    val count = mutableMapOf<Long,Int>()
    for(num in suretu) {
       if(count.containsKey(num)) {
           count[num] = count[num]!! + 1
       } else {
           count[num] = 1
       }
    }
    var ans = 0L
    for((key,v) in count) {
        if(key == v.toLong()) {
            continue
        }
        if(key > v.toLong()) {
            ans += v.toLong()
        } else {
            ans += v.toLong() - key
        }
    }
    println(ans)

}
