import scala.io.StdIn

object Main extends App {
  val n = StdIn.readLine.toInt
  val ans = Iterator.continually(StdIn.readLine.toInt)
    .take(n)
    .toVector
    .sorted
    .foldLeft(0,0)((acc,e) => {
      if(acc._2 < e) (acc._1+1, e)
      else (acc._1, e)
    })._1
  println(ans)
}