fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }


    val hashMap = hashMapOf<Int, Int>()
    var answer = 0
    a.forEach {
        if (!hashMap.contains(it)) {
            hashMap[it] = 1
        } else {
            hashMap[it] = hashMap[it]!! + 1
        }
        if (hashMap[it]!! > it) {
            answer++
            hashMap[it] = hashMap[it]!! - 1
        }
    }

    hashMap.keys.forEach {
        if (hashMap[it] != it) {
            answer += hashMap[it]!!
        }
    }

    println(answer)
}
