Making the smoothie is a huge quest, during which you select $$$n$$$ ingredients, represented by numbers from $$$0$$$ to $$$10^9$$$, and arrange them in a sequence $$$a_i$$$. Repeating ingredients is allowed, meaning there could be $$$i$$$ and $$$j$$$ such that $$$a_i = a_j$$$.
Then you need to find the secret ingredient, the number of which is calculated as follows:
Obviously the order of these ingredients can change the number of the secret ingredient. It is known that the higher this number is, the more delicious the smoothie made with it will be.
Arrange the selected ingredients so that the corresponding number of the secret ingredient for the resulting sequence is as large as possible.
The first line of input contains a single integer $$$n$$$ — the number of ingredients you have $$$(1 \leq n \leq 2 \cdot 10^5)$$$.
The second line lists $$$n$$$ integers from $$$0$$$ to $$$10^9$$$ — the numbers of these ingredients.
Output a single integer — the maximum possible number of the secret ingredient.
51 1 0 2 5
4
30 0 0
0
In the first example, one way to arrange the ingredients looks like $$$a = [5, 0, 1, 2, 1]$$$. In this case, we get $$$b = [0, 1, 2, 3, 3]$$$, the mex of which is $$$4$$$.
| Name |
|---|


