Yash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish if 
 1.  the sequence consists of at least two elements 1.  *f*<sub class="lower-index">0</sub> and *f*<sub class="lower-index">1</sub> are arbitrary 1.  *f*<sub class="lower-index">*n* + 2</sub> = *f*<sub class="lower-index">*n* + 1</sub> + *f*<sub class="lower-index">*n*</sub> for all *n* ≥ 0. 
You are given some sequence of integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub>. Your task is rearrange elements of this sequence in such a way that its longest possible prefix is Fibonacci-ish sequence.
The first line of the input contains a single integer *n* (2 ≤ *n* ≤ 1000) — the length of the sequence *a*<sub class="lower-index">*i*</sub>.

The second line contains *n* integers *a*<sub class="lower-index">1</sub>, *a*<sub class="lower-index">2</sub>, ..., *a*<sub class="lower-index">*n*</sub> (|*a*<sub class="lower-index">*i*</sub>| ≤ 10<sup class="upper-index">9</sup>).
In the first sample, if we rearrange elements of the sequence as  - 1, 2, 1, the whole sequence *a*<sub class="lower-index">*i*</sub> would be Fibonacci-ish.

In the second sample, the optimal way to rearrange elements is <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/16f1f7e35511b29cb1396890ca2fb7dfa4d428de.png" style="max-width: 100.0%;max-height: 100.0%;"/>, <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/4003973f16750522e492d7d79318d7e2f0ff99cd.png" style="max-width: 100.0%;max-height: 100.0%;"/>, <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/87b18fd9524b11e12faf154302fb14c1b55556fb.png" style="max-width: 100.0%;max-height: 100.0%;"/>, <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/b8950ea952476baea26e03281fa2f7640b6241ef.png" style="max-width: 100.0%;max-height: 100.0%;"/>, 28.
3
1 2 -1
3
5
28 35 7 14 21
4
11
-9 -1 -10 9 7 -4 0 -8 -3 3 5
5
10
-4 -8 -8 8 -9 0 -7 9 1 0
4
2
2 2
2
4
1 -1 0 -2
4
2
1000000000 1000000000
2
3
1 1 2
3
5
0 0 0 0 0
5
6
1 -1 0 -1 -1 -2
6
5
-7 0 -7 -7 -14
5
3
0 -44 -49
2
5
-1 1 0 0 0
3
2
0 0
2
3
0 0 0
3
4
0 0 0 0
4
5
0 0 0 0 0
5
10
0 0 0 0 0 0 0 0 0 0
10
input()
t = list(map(int, input().split()))
s = {}
for q in t: s[q] = s.get(q, 0) + 1
n = 0
t = set(t)
for a in t:
    for b in t:
        d = {a: 1, b: 1} if a != b else {a: 2}
        if s[a] < d[a]: continue
        k = 2
        c = a + b
        while c in s and (c not in d or s[c] > d[c]):
            a, b = b, c
            d[c] = d.get(c, 0) + 1
            k += 1
            c = a + b
        n = max(n, k)
print(n)