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.*;
import java.lang.reflect.Array;
import java.math.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.regex.Matcher;

/**
 * @author ramilagger
 *
 */
public class Main {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    final BufferedReader br;
    final PrintWriter pw;
    StringTokenizer st;
    int n,b,f,s,t;

    public void solve() throws Exception {
        int n = nextInt();
        int a[] = new int[n];

        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        int cnt;
        Arrays.sort(a);
        int z = Arrays.binarySearch(a,0);
        while (z - 1 > -1 && a[z - 1] == 0){
            z--;
        }
        cnt = 1;
        if(z > -1) {
            while (z + 1 < n && a[z + 1] == 0) {
                z++;
                cnt++;
            }
        }
        int max = cnt;

        boolean map[];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n && j != i; j++) {
                f = a[i];
                s = a[j];
                map = new boolean[n];
                map[i] = true;
                map[j] = true;
                cnt = 2;
                if (f == 0 && s == 0) {
                    continue;
                } else {
                   // pw.print(f +" "+ s +" ");

                    while (true) {

                        t = f + s;
                        //pw.print(t + " ");
                        int idx = Arrays.binarySearch(a, t);
                        if (idx >= 0) {

                            if(map[idx]) {
                                while (idx - 1 > -1 && a[idx - 1] == t) {
                                    idx--;
                                    if(!map[idx]){
                                        break;
                                    }
                                }
                            }
                            if(map[idx]) {
                                while (idx + 1 < n && a[idx + 1] == t) {
                                    idx++;
                                    if(!map[idx]){
                                        break;
                                    }
                                }
                            }

                            if (!map[idx] && a[idx] == t) {
                                map[idx] = true;
                                f = s;
                                s = t;
                                cnt++;
                            }

                            else {
                                max = Math.max(max, cnt);
                                break;
                            }

                        }
                        else {
                            max = Math.max(max, cnt);
                            break;
                        }
                    }
                }
                f = a[j];
                s = a[i];
                map = new boolean[n];
                map[i] = true;
                map[j] = true;
                cnt = 2;
                if (f == 0 && s == 0) {
                    continue;
                } else {
                   // pw.print(f +" "+ s +" ");

                    while (true) {

                        t = f + s;
                        //pw.print(t + " ");
                        int idx = Arrays.binarySearch(a, t);
                        if (idx >= 0) {

                            if(map[idx]) {
                                while (idx - 1 > -1 && a[idx - 1] == t) {
                                    idx--;
                                    if(!map[idx]){
                                        break;
                                    }
                                }
                            }
                            if(map[idx]) {
                                while (idx + 1 < n && a[idx + 1] == t) {
                                    idx++;
                                    if(!map[idx]){
                                        break;
                                    }
                                }
                            }

                            if (!map[idx] && a[idx] == t) {
                                map[idx] = true;
                                f = s;
                                s = t;
                                cnt++;
                            }

                            else {
                                max = Math.max(max, cnt);
                                break;
                            }

                        }
                        else {
                            max = Math.max(max, cnt);
                            break;
                        }
                    }
                }
                //pw.println();
            }
        }
        pw.println(max);
    }


    public void run() throws Exception{
        long start = System.currentTimeMillis();
        solve();
        if(!ONLINE_JUDGE){
            long end = System.currentTimeMillis();
            System.err.println(end - start + " ms");
        }
        pw.close();
    }

    public Main() throws Exception {

        br = (ONLINE_JUDGE) ? new BufferedReader(new InputStreamReader(System.in))
                : new BufferedReader(new FileReader("in.txt"));

        pw = (ONLINE_JUDGE) ?
                new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)))
                : new PrintWriter(new BufferedWriter(new FileWriter("out.txt")));

    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }

    public String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public BigInteger nextBigInteger () throws IOException {
        return new BigInteger(next());
    }

    public String nextLine() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            return br.readLine();
        }
        StringBuilder s = new StringBuilder(st.nextToken());
        while (st.hasMoreTokens()){
            s.append(" " + st.nextToken());
        }
        return s.toString();
    }

}