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
from collections import Counter, defaultdict
from itertools import permutations, combinations
raw_input = stdin.readline
pr = stdout.write
mod=10**9+7

def ni():
    return int(raw_input())


def li():
    return map(int,raw_input().split())


def pn(n):
    stdout.write(str(n)+'\n')


def pa(arr):
    pr(' '.join(map(str,arr))+'\n')

# fast read function for total integer input

def inp():
    # this function returns whole input of
    # space/line seperated integers
    # Use Ctrl+D to flush stdin.
    return map(int,stdin.read().split())

range = xrange # not for python 3.0+

# main code

n=ni()
l=li()
d=Counter(l)
ans=0
for i in range(n):
    d[l[i]]-=1
    for j in range(n):
        if i==j:
            continue
        if l[i]==0 and l[j]==0:
            ans=max(ans,d[0]+1)
            continue
        d[l[j]]-=1
        temp=2
        prev=l[j]
        curr=l[i]+l[j]
        ans1=[]
        while d[curr]:
            temp+=1
            d[curr]-=1
            ans1.append(curr)
            prev,curr=curr,prev+curr
        ans=max(ans,temp)
        for k in ans1:
            d[k]+=1
        d[l[j]]+=1
    d[l[i]]+=1

    
pn(ans)
