Sequence
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
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 (1 ≤ n ≤ 10^5
) of elements in the sequence. The next line gives the sequence of n integers a[i]
(1 ≤ a[i]
≤ 10^6
), separated by spaces.
Output
Print one number - the maximum length of subsequence, where the elements go one after another, each one greater than previous.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 28%