#C3295. Find Peak Element

    ID: 46706 Type: Default 1000ms 256MiB

Find Peak Element

Find Peak Element

You are given an array of integers. Your task is to find and output the index of any one peak element in the array.

A peak element is defined as an element that is greater than or equal to its neighbors. For the first and last elements, consider only one neighbor. It is guaranteed that the input array has at least one peak element.

Note: If there are multiple peak elements, you can output the index of any one.

Example:

Input:
6
1 3 20 4 1 0

Output: 2

</p>

inputFormat

The first line of the input contains an integer n, the number of elements in the array. The second line contains n space-separated integers representing the elements of the array.

Example:

6
1 3 20 4 1 0

outputFormat

Output a single integer, which is the index of any one peak element in the array. If multiple answers are possible, output any one.

Example:

2
## sample
1
1
0

</p>