Time limit 1000/1000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Problem description
Bob loves playing with numbers. One day he found a piece of paper with N integer numbers on it. He decided to select some numbers from it without changing their position so that selected numbers form arithmetical progression. Help him in finding the longest arithmetical progression from given numbers.
Input
Line 1: A single integer: N (2 <= N <= 1000).
Line 2: N integers ai which were on the paper (-10000 <= ai <= 10000).
Output
Single integer, length of longest arithmetical progression.
Example
| stdin |
stdout |
13
-6 -2 1 2 5 6 7 9 16 13 16 17 20
|
5 |
Для отправки решений необходимо выполнить вход.
|