import scala.io.{StdIn => in}
import scala.collection.{mutable => mu}

object Main extends App {
  import MapHelper._
  val map = mu.HashMap.empty[Int,Int]
  val n = in.readInt
  in.readLine.split(" ").map(_.toInt)
    .foreach(i => map.addOrUpdate(i,1))

  val ans = map.keys./:(0L)((acc,i) => {
    if(map(i) >= i) acc + map(i) - i
    else acc + map(i)
  })

  println(ans)
  object MapHelper {
    implicit class AddOrUpdate[A](map:mu.HashMap[Int,Int]) {
      def addOrUpdate(key:Int, value:Int):mu.HashMap[Int,Int] =
      {
        if(map.contains(key)) map(key) += value
        else map += (key -> value)
        map
      }
    }
  }
}