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.
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.
Print one number - the maximum length of subsequence, where the elements go one after another, each one greater than previous.