Huseyn's training#11655

Huseyn's training

1 second
128 megabytes
Easy

Huseyn 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.

Huseyn has a list of contests, the -th contest consists of a_i problems. During each day Huseyn 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 Huseyn didn't solve yet during the -th day, then Huseyn stops his training.

How many days Huseyn can train if he chooses the contests optimally?

Input

The first line contains one integer n~(1 \le n \le 2 \cdot 10^5) — the number of contests.

The second line contains integers a_1, a_2, ..., a_n~(1 \le a_i \le 2 \cdot 10^5) — the number of problems in the -th contest.

Output

Print one integer — the maximum number of days Huseyn can train if he chooses the contests optimally.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading