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.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Task2 {

    public static void main(String[] args) throws IOException {

        new Task2().solve();

    }

    //ArrayList<Integer>[] g;

    int mod = 1000000007;

    PrintWriter out;

    int n;
    int m;
    //int[] a;
    long inf = Long.MAX_VALUE;

    //int[][] g = new int[110][110];

    void solve() throws IOException {

        //Reader in = new Reader("in.txt");
        //out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        Reader in = new Reader();
        PrintWriter out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );

        //BufferedReader br = new BufferedReader( new FileReader("in.txt") );
        //BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );

        int n = in.nextInt();

        int[] a = new int[n];

        int ans = 0;

        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            if (x == 0)
                ans++;
            a[i] = x;
        }

        Arrays.sort(a);

        int[] nx = new int[1100];
        int[] fib = new int[1100];
        int[] inds = new int[1100];

        int time = 0;

        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++) {

                if (a[i] == 0 && a[j] == 0 || i == j)
                    continue;

                time++;

                fib[0] = a[i];
                fib[1] = a[j];
                int num = 2;

                int ind = bins(0, n-1, a[i], a);
                nx[ind] = time;
                //inds[0] = ind;
                ind = bins(0, n-1, a[j], a);
                nx[ind] = time;
                int cnt = 2;
                //inds[1] = ind;

                while (true) {

                    fib[num] = fib[num-1]+fib[num-2];
                    ind = bins(0, n-1, fib[num], a);
                    //inds[num] = ind;
                    //System.out.println(fib[num]);

                    if (ind == -1)
                        break;

                    while (ind < n && nx[ind] == time && a[ind] == fib[num])
                        ind++;

                    if (ind >= n || a[ind] != fib[num]) {
                        break;
                    }
                    else {
                        nx[ind] = time;
                    }

                    cnt++;
                    num++;
                }

                //if (num == 5)
                //    System.out.println(num+" " + a[i]+" "+a[j]+" "+fib[1]);

                ans = Math.max(ans, num);

            }

        out.println(ans);
        out.flush();
        out.close();
    }

    int bins(int i, int j, int x, int[] a) {

        while (j > i) {

            int m = i + (j-i)/2;

            if (a[m] < x)
                i = m+1;
            else
                j = m;
        }

        if (a[j] == x)
            return j;

        return -1;
    }

    long gcd(long a, long b) {

        if (b == 0)
            return a;

        return gcd(b, a%b);

    }

    class Point implements Comparable<Point> {

        int x;
        int y;
        long d;

        Point(int x, int y, long d) {
            this.x = x;
            this.y = y;
            this.d = d;
        }

        @Override
        public int compareTo(Point o) {
            if (d > o.d)
                return 1;
            if (d < o.d)
                return -1;
            return 0;
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Pair implements Comparable<Pair>{

        int a;
        int b;

        Pair(int a, int b) {

            this.a = a;
            this.b = b;
        }

        public int compareTo(Pair p) {

            if (a > p.a)
                return 1;

            if (a < p.a)
                return -1;

            if (b > p.b)
                return 1;

            if (b < p.b)
                return -1;

            return 0;
        }

        //		@Override
        //		public boolean equals(Object o) {
        //			Pair p = (Pair) o;
        //			return a == p.a && b == p.b;
        //		}
        //
        //		@Override
        //		public int hashCode() {
        //			return Integer.valueOf(a).hashCode() + Integer.valueOf(b).hashCode();
        //		}

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

    }

}