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.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class d1 extends PrintWriter {

    static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
    // static Scanner s=new Scanner(System.in);
    d1 () { super(System.out); }
    public static void main(String[] args) throws IOException{
        d1 d1=new d1();d1.main();d1.flush();
    }
    void main() throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        StringBuffer sb = new StringBuffer();
        StringBuffer sb1 = new StringBuffer();
        PrintWriter out = new PrintWriter(System.out);
        String[] s1=s();
          int n=i(s1[0]);

          long[] a=new long[n];
          arr(a,n);HashMap<Long,Integer> h=new HashMap<>();
         Arrays.sort(a);
         HashMap<Long,Integer> cpp=new HashMap<>();
        long[] [] vis=new long[n][n];
        for(int i=0;i<n;i++){
            h.put((long)a[i],i);cpp.put(a[i],cpp.getOrDefault(a[i],0)+1);
          }long ans=2;
        long[] [] dp=new long[n][n];
        for(int i=0;i<n;i++){
              for(int j=0;j<n;j++){
                  if(i==j) continue;
                  if(vis[h.get(a[i])][h.get(a[j])]==1){
                      continue;
                  }vis[h.get(a[i])][h.get(a[j])]=1;cpp.put(a[i],cpp.get(a[i])-1);cpp.put(a[j],cpp.get(a[j])-1);
                  int count=2;long x=a[i]+a[j];long prev=a[j];
                  Stack<Long> st=new Stack<>();st.push(a[i]);st.push(a[j]);

                  long few=0;
//                  System.out.println("HI"+a[i]+" "+a[j]);
                  while(h.containsKey(x)&&cpp.get(x)>0){
//                      System.out.println(x);
//                      if(vis[h.get(prev)][h.get(x)]==1){
//                          few=dp[h.get(prev)][h.get(x)];count+=(few-1);
//                          break;
//                      }
 count++;
                     st.push(x);
                     cpp.put(x,cpp.get(x)-1);

                     vis[h.get(prev)][h.get(x)]=1;
                     long x1=x;
                     x+=prev;
                     prev=x1;
                  }long next=-1;//int few=0;
//                      System.out.println("HI");
                  while(!st.isEmpty()){

                      x=st.pop();few++;
//                      System.out.println(x);
                      if(next!=-1){
                          dp[h.get(x)][h.get(next)]=few;
                      }next=x;
                      cpp.put(x,cpp.get(x)+1);
                  }
                  ans=Math.max(ans,count);

              }
          }
        System.out.println(ans);
    }int n;int[]z;
    public void zarr(char[] a){
        z=new int[n];
        z[0]=1;int l=0;int r=0;
        for(int i=1;i<a.length;i++){
            if(i<=r){
                if(i+z[i-l]-1>=r){
                    l=i;int j;
                    while(r < a.length && a[r - l] == a[r])
                        r++;
                    z[i]=r-l;
                    r--;
                }else{
                    z[i]=z[i-l];
                }
            }else{
                l=i;
                r=l;int j;
                while(r < a.length && a[r - l] == a[r])
                    r++;

                z[i]=r-l;
                r--;
            }}
    }
    static long powerwithmod(long  x, long y, long p) {
        long  res = 1;
        x = x % p;
        while (y > 0) {
            if ((y & 1) == 1)
                res = (res * x) % p;
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }
    public void arr(long[] a,int n) throws IOException{
        //        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String[] s2=s();
        for(int i=0;i<n;i++){
            a[i]=i(s2[i]);
        }
    }
    public void sort(int[] a,int l,int h){
        if(l==h) return;
        int mid=(l+h)/2;

        sort(a,l,mid);
        sort(a,mid+1,h);
        merge(a,l,(l+h)/2,h);
    }
    void merge(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int[n1];
        int R[] = new int[n2];
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            }
            else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }


    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    static String[] s() throws IOException {
        return s.readLine().trim().split("\\s+");
    }

    static int i(String ss) {
        return Integer.parseInt(ss);
    }
    static long l(String ss) {
        return Long.parseLong(ss);
    }
}
class Student {
    long  a;int b;int c;
    public Student(int a,int b) {
        this.a=a;this.c=c;this.b=b;
    }
}
class Pair {
    int  a,b,c;
    public Pair(int  a,int b){
        this.a=a;this.b=b;this.c=c;}
}
class Sortbyroll implements Comparator<Student> {

    public int compare(Student a, Student b){
        if(a.b==b.b) return (int)b.a-(int)a.a;
        return   a.b-b.b;}
}

