import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val al = Seq.fill(n)(sc.nextInt)

  val aDistinct = al.distinct
  
  val containsCounts =
    aDistinct.map{ e =>
      e -> al.count(_ == e)
    }

  val res =
    containsCounts.foldLeft(0){case (acc, (e,cnt)) =>
      val added =
        if(e > cnt) cnt else cnt - e
      acc + added
  }

  println(res)
}