Time limit
1s
Memory limit
128 MB
You are given a sequence of length N made of digits from 0 to 9. Consider contiguous segments that, from left to right, are either nondecreasing or nonincreasing.
Print the maximum possible length of such a segment. Equal adjacent digits satisfy both direction conditions.
The first line contains the length N of the sequence.
The second line contains N digits separated by spaces.
N is an integer between 1 and 100,000, inclusive.
Print the length of the longest contiguous segment that is nondecreasing or nonincreasing.