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 containsCounts =
    al.foldLeft(Map.empty[Int, Int]){ case (m, e) =>
      if (m.isDefinedAt(e)) m.updated(e, m(e) + 1)
      else Map(e -> 1) ++ m

      // m で定義されている  =>  mapValue
      // m で定義されていない=>  mapを追加
  }

//  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)
}