AT_abc446_d [ABC446D] Max Straight

Description

You are given an integer sequence $ A=(A_1,A_2,\ldots,A_N) $ of length $ N $ . Find the maximum length of a subsequence $ B=(B_1,B_2,\ldots,B_{|B|}) $ of integer sequence $ A $ that satisfies the following condition. - $ B_i+1=B_{i+1} $ for all integers $ i $ satisfying $ 1\le i\le |B| - 1 $ . What is a subsequence A subsequence of sequence $ A $ is a sequence obtained by choosing zero or more elements of $ A $ to delete, and arranging the remaining elements in their original order.

Input Format

The input is given from Standard Input in the following format: > $ N $ $ A_1 $ $ A_2 $ $ \ldots $ $ A_N $

Output Format

Output the answer.

Explanation/Hint

### Sample Explanation 1 $ B=(3,4,5,6) $ is a subsequence of $ A $ that satisfies the condition, and its length is $ 4 $ . There is no subsequence satisfying the condition with length greater than $ 4 $ , so output $ 4 $ . ### Constraints - $ 1\le N\le 2\times 10^5 $ - $ 1\le A_i\le 10^9 $ - All input values are integers.