Limits 1s, 512 MB

nn racers have competed in a Formula 1 racing tournament. Given the amount of time taken by each driver to complete the race, write a program that identifies the number of the racer who won the bronze medal (i.e. stood third in the race). Assume, the racers are numbered from 1 to n.

The racer that takes the least amount of time to finish gets the gold medal, the racer that finished second takes the silver medal, and the racer that took the third-lowest time to finish wins the third prize.


The input contains two lines, the first of which contains nn, the number of competing racers. The second line contains nn space-separated integer values, the ithi^{th} of which denotes aia_{i}, the number of seconds taken by the racer numbered ii to complete the race. You can assume that there were no ties, that is, each racer took a different amount of time to finish.


3n10003 \leq n \leq 1000

1ai1091 \leq a_{i} \leq 10^{9}


Output a single integer, the number of the racer who won the bronze medal.


1 5 4 3

Here, racer 1 takes 1 second to finish the race, racer 2 takes 5 seconds and the racers numbered 3 and 4 take 4 and 3 seconds respectively.

Thus, racer 1 wins the first prize, racer 4 wins silver and racer 3 wins the third prize. Therefore, the output is 3.


Login to submit.



82% Solution Ratio
TanbeerEarliest, Apr '21
wasimur_01Fastest, 0.0s
TanbeerLightest, 131 kB
bokaifShortest, 71B
Toph uses cookies. By continuing you agree to our Cookie Policy.