object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val l = Vector.fill(n)(sc.nextInt())

  val out = l.groupBy((x: Int) => x).map { case (x: Int, cs: Vector[Int]) =>
    val c = cs.size
    if (c - x < 0) c else c - x
  }.sum
//  val out = l.toSet.toVector.map { x: Int =>
//    val c = l.count(_ == x)
//  }.sum
  println(out)
}
