fb pixel

Finding the peak

You are given an array of n integers. You are asked to find the rightmost peak element in that array. We consider an element to be a peak if it’s greater or equal to two of its neighbors ().

Input

The first line of the input contains the number n (3 ≤ n ≤ ). The second line contains n integers representing the array a, where each element (). It’s guaranteed that there is at least one peak in the given array.

Output

The program should print the value of the rightmost peak element. In case it’s impossible to find a peak, the program should print Impossible.

Examples

Input
Output
5 7 20 0 8 7
8
6 0 2 -1 4 5 7
2
3 1 2 3
Impossible
 
To check your solution you need to sign in
Sign in to continue