SJSU Weekly Practice Problems 12/26

Start

2021-12-26 20:00 AKST

SJSU Weekly Practice Problems 12/26

End

2022-01-02 20:00 AKST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -145 days 8:11:35

Time elapsed

168:00:00

Time remaining

0:00:00

Problem I
H-Index

/problems/hindex/file/statement/en/img-0001.jpg
 

In research, it is tough to determine how good of a researcher you are. One way that people determine how good you are is by looking at your $H$-Index.

Each paper has a certain number of citations. Your $H$-Index is the largest number $H$ such that you have $H$ papers with at least $H$ citations. Given the number of citations on each paper you have written, what is your $H$-Index?

Input

The first line of input contains a single integer $n$ ($1 \leq n \leq 100\, 000$), which is the number of papers you have written.

The next $n$ lines describe the papers. Each of these lines contains a single integer $c$ ($0 \leq c \leq 1\, 000\, 000\, 000$), which is the number of citations that this paper has.

Output

Display your $H$-Index.

Sample Input 1 Sample Output 1
5
7
1
2
1
5
2
Sample Input 2 Sample Output 2
5
7
1
3
1
5
3
Sample Input 3 Sample Output 3
3
4
2
3
2