#P1165B. Polycarp Training
Polycarp Training
Description
Polycarp wants to train before another programming competition. During the first day of his training he should solve exactly problem, during the second day — exactly problems, during the third day — exactly problems, and so on. During the -th day he should solve problems.
Polycarp has a list of contests, the -th contest consists of problems. During each day Polycarp has to choose exactly one of the contests he didn't solve yet and solve it. He solves exactly problems from this contest. Other problems are discarded from it. If there are no contests consisting of at least problems that Polycarp didn't solve yet during the -th day, then Polycarp stops his training.
How many days Polycarp can train if he chooses the contests optimally?
The first line of the input contains one integer () — the number of contests.
The second line of the input contains integers () — the number of problems in the -th contest.
Print one integer — the maximum number of days Polycarp can train if he chooses the contests optimally.
Input
The first line of the input contains one integer () — the number of contests.
The second line of the input contains integers () — the number of problems in the -th contest.
Output
Print one integer — the maximum number of days Polycarp can train if he chooses the contests optimally.