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.
//package com.company;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class Main {

    public static void main(String[] args) throws IOException {
        // write your code here
      // Scanner s = new Scanner(System.in);
          BufferedReader s=new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
 int n=Integer.parseInt(s.readLine());HashMap<Long,Long> h=new HashMap<Long, Long>();
        Long[] a=new Long[n];String[] str=s.readLine().trim().split("\\s+");
        for(int i=0;i<n;i++){
            a[i]=Long.parseLong(str[i]);
            if(h.containsKey(a[i])) h.put(a[i],h.get(a[i])+1);
            else h.put(a[i],1L);
        }long ans=0;
 for(int i=0;i<n;i++){
     for(int j=0;j<n;j++){
         if(i==j) continue;
         if(a[i]==0L&&a[j]==0L) {
             ans=Math.max(ans,h.get(0L));continue;
         }
         HashMap<Long,Long> h1=new HashMap<Long, Long>();
         int l=2;h1.put(a[i],1L);if(!h1.containsKey(a[j]))h1.put(a[j],1L);else h1.put(a[j],h.get(a[j]+1L));Long x=a[i];Long y=a[j];

         while(h.containsKey(x+y)){
             if(h1.containsKey(x+y)&&h.get(x+y)-h1.get(x+y)==0) break;
             l++;
             long z=x+y;x=y;y=z;if(h1.containsKey(z)) h1.put(z,h1.get(z)+1);else h1.put(z,1L);
         }ans=Math.max(ans,l);
     }
 }
        System.out.println(ans);
 }
    static double power(double x, long y, int p)
    {
        double 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 static boolean dfs(int papa,int i, ArrayList<Integer>[] h, int[] vis) {
   vis[i]=1;
        if(h[i]==null) return false ;
boolean f=false;        for (Integer j : h[i]) {
            if (vis[j] == 0) {
                f=dfs(i,j, h, vis);
            }
        }return false;
    }static long max=Long.MIN_VALUE;static long max1=Long.MIN_VALUE;

    public static void bfs(int i, HashMap<Integer, Integer>[] h, int[] vis, int len, int papa) {
        Queue<Integer> q = new LinkedList<Integer>();
        q.add(i);

    }


    static int i(String a){
        return Integer.parseInt(a);
    }static long l(String a){
        return Long.parseLong(a);
    }static String[] inp() throws IOException{
        BufferedReader s=new BufferedReader(new InputStreamReader(System.in));
        return s.readLine().trim().split("\\s+");
    }
}

class Student
{
 String name;int no,score;
//    String name, address;

    // Constructor
    public Student(String name, int no,int score)
    {this.name=name;this.no=no;this.score=score;


    }

    // Used to print student details in main()
    public String toString()
    {
        return this.name;
    }
}

class Sortbyroll implements Comparator<Student>
{
    // Used for sorting in ascending order of
    // roll number
    public int compare(Student a, Student b)
    {
        if(a.no!=b.no) return a.no-b.no ;else return b.score-a.score;
    }
}