eolymp
bolt
Try our new interface for solving problems
Problems

Sequence

Sequence

Given a sequence of n integers. Find the length of its maximal subsequence of the elements, going one after another, such that each element in this subsequence is larger than previous by one.

Input

The first line contains the number n (1n105) of elements in the sequence. The next line gives the sequence of n integers ai (1ai106), separated by spaces.

Output

Print one number - the maximum length of subsequence, where the elements go one after another, each one greater than previous.

Time limit 1 second
Memory limit 128 MiB
Input example #1
6
1 2 4 3 4 5
Output example #1
3
Author A. Kozlov
Source ACM, Ukraine, First Stage, 09.04.2011