fun main(args: Array<String>) {
    val n= readLine()!!.toInt()
    val a = readLine()!!.split(" ").map{ it.toLong() }
            .groupBy{ it }
            .mapValues { it.value.size }
            .toList()
            .fold(0L){ acc, pair ->
                val number=pair.first
                val count = pair.second.toLong()
                return@fold acc + if(count<number) count else count-number
            }
            .let { println(it) }

}