
fun main(args:Array<String>): Unit {
    readLine()!!.trim().toInt()
    val scores = readLine()!!.trim().split(' ').map(String::toInt)
    val counts = IntArray(100){0}
    for (s in scores) counts[s - 1]++
    for (i in 99 downTo 1) counts[i - 1] += counts[i]
    for (s in 100 downTo 1){
        if (s <= counts[s - 1]){
            println(s)
            return
        }
    }
}
