object Main extends App {
  val src = io.Source.stdin.getLines.toList.drop(1).flatMap(_.split(" ").map(_.toInt)).sortWith(_ > _)

  val li = for { num <- (100 to 1 by -1).toList
                 if num <= src.count(_ >= num)
           } yield num

  println(li.head)
}

