Waved Subarray
题号:NC237179
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

You are given a array of integers. For a pair, we consider it's valid if the subarray between l and r is waved .The array is waved if and only if or .
Fop_zz wants to know the length of the longest waved subarray. Formally, you should tell him the maximum value of for all valid pairs (l,r).
It is guaranteed that vi is between 1 and .

输入描述:

The first line contains the length of the array N.
The second line contains N integers represent the elements of the array v_i

输出描述:

Output a single integer representing the length of the longest waved subarray.
示例1

输入

复制
5
1 3 1 1 4

输出

复制
3