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 
  2. f0 and f1 are arbitrary 
  3. fn + 2 = fn + 1 + fn for all n ≥ 0. 



You are given some sequence of integers a1, a2, ..., an. Your task is rearrange elements of this sequence in such a way that its longest possible prefix is Fibonacci-ish sequence.

Input

The first line of the input contains a single integer n (2 ≤ n ≤ 1000) — the length of the sequence ai.

The second line contains n integers a1, a2, ..., an (|ai| ≤ 109).

Output

Print the length of the longest possible Fibonacci-ish prefix of the given sequence after rearrangement.

Examples

Input

3
1 2 -1


Output

3


Input

5
28 35 7 14 21


Output

4

Note

In the first sample, if we rearrange elements of the sequence as  - 1, 2, 1, the whole sequence ai would be Fibonacci-ish.

In the second sample, the optimal way to rearrange elements is <image>, <image>, <image>, <image>, 28.
from sys import stdin, stdout

def fin(): return stdin.readline().strip()
def fout(x): stdout.write(str(x) + '\n')

def m_add(mp, val):
    mp[val] = mp.get(val, 0) + 1
def m_remove(mp, val):
    if mp[val] == 1:
        mp.pop(val)
    else:
        mp[val] -= 1


n, arr, mp, res = int(fin()), list(map(int, fin().split())), {}, 0
for i in arr: m_add(mp, i)

for i in range(n):
    for j in range(n):
        if i == j: continue
        cnt, a, b = 2, arr[i], arr[j]

        if a == 0 and b == 0:
            res = max(res, mp[0])
            continue

        m_remove(mp, a)
        m_remove(mp, b)
        
        while a+b in mp:
            m_remove(mp, a+b)
            a, b = b, a+b
            cnt += 1
        
        res = max(res, cnt)
        while a != arr[i] or b != arr[j]:
            a, b = b - a, a
            m_add(mp, a+b)
        
        m_add(mp, a)
        m_add(mp, b)
print(res)
