Problems
Fibonacci sequence
Fibonacci sequence
A set of distinct integers is given. Find the length of the longest sequence of Fibonacci numbers that can be arranged from them. Each number can be used in the sequence no more than once. The sequence F is called the Fibonacci sequence, if
F[1]
= a
F[2]
= b
F[i]
= F[i–2]
+ F[i–1]
Input data
The first line contains the number n (2 ≤ n ≤ 10000) of elements in the set. The second line contains n distinct integers a[i]
(1 ≤ a[i]
≤ 10^9
).
Output data
Print the length of the longest Fibonacci sequence, that can be created from given numbers.
Examples
Input example #1
6 2 3 4 5 6 9
Output example #1
3