An elevation profile is given as n measurements in order. A ramp is a pair of positions (i, j) with i <= j and value[i] <= value[j]; its width is j - i. Find the maximum width over all ramps.
Since taking i = j is always a valid ramp of width 0, the answer is never negative; it is a positive number exactly when some earlier position has a value less than or equal to some later position's value.
Input format
Line 1: an integer n.
Line 2: n space-separated integers, the measurements in order.
Output format
A single integer: the maximum ramp width.
Constraints
- 1 <= n <= 100000
- 1 <= value <= 1000000000