405034: GYM101744 L MaratonIME goes karting

Memory Limit:64 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

L. MaratonIME goes kartingtime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputYan, it's red!!!desperate, Passengers

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.

Input

The 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
Output

The output consists in a single integer i, the champion competitive programmer. If it's not possible to determine the champion, print  - 1.

ExampleInput
3
2 4 6
Output
3

加入题单

算法标签: