AdvancedRating 1700
Longest Arithmetic Subsequence
Print the length of the longest subsequence (keeping order) whose neighbouring differences are all equal.
Input
n (≤ 1000), then n integers.
Output
One integer.
Sample 1
Input
4 3 6 9 12
Output
4
Sample 2
Input
5 9 4 7 2 10
Output
3
Output appears here