import scala.io.StdIn

object Main extends App {
  val n = StdIn.readLine().toInt
  val a = StdIn.readLine().split(' ').map(_.toLong)
  
  val b = a.groupBy(f => f)
  println(b.foldLeft(0L)( (acc, e) => acc + (if(e._2.length >= e._1) e._2.length - e._1 else e._2.length)))
  
}