fun main(args: Array<String>) {
    val n = readInputLine().toInt()
    val aList = readInputLine().split(" ").map { it.toInt() }.toMutableList()
    
    aList.sort()

    var ans = 0
    var currentNum = 0
    var count = 0
    
    for (a in aList) {
        if (a == currentNum) {
            count++
        } else {
            ans = addAns(currentNum, count, ans)
            currentNum = a
            count = 1
        }
    }
    
    ans = addAns(currentNum, count, ans)
    
    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}

fun addAns(num: Int, count: Int, ans: Int): Int {
    if (count < num) {
        return ans + count
    } else {
        return ans + count - num
    }
}
