~/algor $ cat problems/minmax-11-oxirgi-ekstremal-element
Last extreme element
Easy
1000 ms
256 MB
25%
A positive integer $N$ and $N$ integers are given. Find the position of the extreme (that is, minimum or maximum) element that occurs last in the sequence.
Input
The first line contains an integer $N$. The next line contains $N$ integers $A_{i}$.
Output
One integer — the position of the last extreme element.
Note
$1 \le N \le 1000$
$-10^{9} \le A_{i} \le 10^{9}$
Examples
Input #1
5 4 2 8 2 7
Output #1
4
Input #2
4 3 8 5 8
Output #2
4