Sticks Problem#1102

Sticks Problem

1 second
128 megabytes
Easy

Sofia has sticks of different lengths. One day, she arranged them in a row, with lengths s_1, s_2, s_3, \ldots, s_n. After measuring each stick s_k (1 \le k \le n), she noticed that for some pairs of sticks s_i and s_j (1 \le i < j \le n), the length of every stick placed between s_i and s_j is strictly greater than s_i and strictly less than s_j.

Given the sequence of lengths s_1, s_2, s_3, \ldots, s_n, find the maximum possible value of the difference j - i.

Input

The input consists of multiple test cases. Each test case consists of two lines. The first line contains an integer (n \le 50000), the number of sticks. The second line contains distinct positive integers (each not exceeding 10^5), the lengths of the sticks.

Output

For each test case, print the maximum value of j - i on a separate line. If no such indices and exist, print .

Examples

Example 1

Loading
Loading