Peak Element#11287

Peak Element

1 second
128 megabytes
Easy

A peak element is an element that is strictly greater than its neighbors.

Given a -indexed integer array , find a peak element, and return its index. If the array contains multiple peaks, return the index to any of the peaks. You may imagine that a_{-1} = a_n = -∞. In other words, an element is always considered to be strictly greater than a neighbor that is outside the array.

Input

The first line contains the size of array n~(n \le 10^6). The second line contains integers a_0, a_1, \ldots, a_{n-1}. It is known that |a_i| \le 10^9 and also that a_i \ne a_{i + 1} for i = 0, 1, \ldots, n - 2.

Output

Print the index of a peak element. If the array contains multiple peaks, return the index to any of the peaks.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading