Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/array/index-of-the-first-local-maximum

Index of the first local maximum

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Easy 1000 ms 128 MB 30%
Share

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 ).

The index of a local maximum greater than both neighbours

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

Sign in to submit a solution

Signing up is free and takes a minute.