Aleksa is having a New Year's Eve party! His house has a magic doorway that only allows person to enter per second, and he knows people will show up.
If two guests arrive at same time, one guest must wait for the other to enter. If two guests arrive at different times, the guest arriving first must enter first.
Given the arrival times for all guests, determine the entry time of the last guest.
Input Format
The first line contains an integer, , denoting the number of guests.
The second line contains integers, , where is the arrival time of guest.
Constraints
Output Format
Print the time that the last guest enters the magic doorway.
Sample Input 1:
8
2 2 2 2 4 4 4 6
Sample Output 1:
9
Sample Input 2:
3
2000 2015 2015
Sample Output 2:
2016
Explanation
For Sample 1:
We know from our constraints that each arrival time . If we refer to as the second when an event occurs, then:
Guest arrives at and enters at .
Guest arrives at and enters at .
Guest arrives at and enters at .
Guest arrives at and enters at .
Guest arrives at and enters at .
Guest arrives at and enters at .
Guest arrives at and enters at .
Guest arrives at and enters at .
Thus, the last guest () enters at .
For Sample 2:
Guest arrives at and enters at .
Guest arrives at and enters at .
Guest arrives at and enters at .
Thus, the last guest () enters at .