Easy h-index
题号:NC52891
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld

题目描述

The h-index of an author is the largest h where he has at least h papers with citations not less than h.
Bobo has published many papers.
Given which means Bobo has published a_i papers with citations exactly i, find the h-index of Bobo.

输入描述:

The input consists of several test cases and is terminated by end-of-file.
The first line of each test case contains an integer n.
The second line contains (n+1) integers .

输出描述:

For each test case, print an integer which denotes the result.
示例1

输入

复制
1
1 2
2
1 2 3
3
0 0 0 0

输出

复制
1
2
0

备注:

* 
*
* The sum of n does not exceed 250,000.