403061: GYM100985 L MaratonIME goes karting
Description
Once after a contest, the competitive programmers were sad because of bad results. Seeing the situation, Renzo, MaratonIME's coach, suggested they should do something fun to relax. After a big discussion, they decided to go karting. Looking for a place that was viable to all students, they found Kartforces, a kart track near Cidade Universitária. However, the track was too small and only fitted two racers by race. As passionate competitive programmers, they organised a fair tournament where everyone raced against everyone, two by two, only once. In each race, the winner got one point on the scoreboard. Draws were allowed and no one scored in this case. The winner was the biggest scorer. There were N competitive programmers present and:
- Each competitive programmer had a skill hi.
- If hi > hj where 1 ≤ i, j ≤ N and i ≠ j, then the competitive programmer i won the race against j.
You had access to the skills of all competitive programmers and now asks who was the champion.
InputThe first line consists on a single integer N, the number of competitive programmers. The second line contains N integers hi, the skill of the i - th competitive programmer.
- 1 ≤ N ≤ 105
- 0 ≤ hi ≤ 109
The output consists in a single integer i, the champion competitive programmer. If it's not possible to determine the champion, print - 1.
ExampleInput3Output
2 4 6
3