#1096. Arithmetic Progression

    ID: 1096 传统题 1000ms 128MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>竞赛洛谷动态规划贪心数组高精度

Arithmetic Progression

Arithmetic Progression

题目描述

“In mathematics, an arithmetic progression (AP) or arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms is constant. For instance, the sequence 5, 7, 9, 11, 13, … is an arithmetic progression with common difference of 2.”

- Wikipedia


This is a quite simple problem, give you the sequence, you are supposed to find the length of the longest consecutive subsequence which is an arithmetic progression.

输入说明

There are several test cases. For each case there are two lines. The first line contains an integer number N (1 <= N <= 100000) indicating the number of the sequence. The following line describes the N integer numbers indicating the sequence, each number will fit in a 32bit signed integer.

输出说明

For each case, please output the answer in one line.

样例

输入

6
1 4 7 9 11 14

输出

3