~/algor $ cat problems/array/index-of-the-first-local-maximum
Index of the first local maximum
Easy
1000 ms
128 MB
30%
A positive integer and an array of integers are given. Find the index of the first local maximum — an element strictly greater than both of its neighbours (indices start from ; if there is none, print ).
Input
The first line contains a positive integer . The second line contains integers separated by spaces.
Output
One integer — the index of the first local maximum or .
Note
Examples
Input #1
5 2 7 4 9 6
Output #1
2
Input #2
4 1 2 3 4
Output #2
0