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.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.*;

public class Problem_04 {

    public static long sign(final long x) {
        if (x >0) return 1;
        if (x < 0) return -1;
        return 0;
    }
    static long MAX = 1000000001;

    static class IntMut {
        public int i = 0;

        public IntMut(int i) {
            this.i = i;
        }
    }

    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = input.nextLong();
        }

        Arrays.sort(a);

        long p = a[0];
        int count = 1;
        int N = 0;
        int[] cnt = new int[n];
        HashMap<Long, Integer> h = new HashMap<>();
        HashSet<Long> saw_p = new HashSet<>();

        for (int i = 1; i < n+1; i++) {
            if (i<n && a[i] == p) {
                count++;
            } else {
                h.put(p, N);
                cnt[N++] = count;
                if (i<n){
                    p = a[i];
                    count = 1;
                }
            }
        }



        if (n == 2) {
            System.out.println("2"); return;
        }

        long maxk = 0; long mf0 = -1; long mf1 = -1;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i == j) continue;
                long f0 = a[i];
                long f1 = a[j];
                long k = 2;
                long lim = Math.abs(f0);

                if (f0 == 0 && f1==0) break;
                if (saw_p.contains(f0 * MAX + f1))
                    break;


                int[] saw = null;

                long sum = f0 + f1;
                while (Math.abs(sum) < MAX) {
                    Integer idx = h.get(sum);
                    if (idx == null) {
                        break;
                    } else {
                        if (saw == null) {
                            saw = new int[N];
                            saw[h.get(f0)]++;
                            saw[h.get(f1)]++;
                        }

                        if (sign(f0)* sign(f1) < 1  ||  Math.abs(f0) <= lim) {
                            if (saw[idx] >= cnt[idx]) {
                                break;
                            } else {
                                saw[idx]++;
                            }
                        } else {
                            saw_p.add(f0 * MAX + f1);
                        }
                    }
                    f0 = f1;
                    f1 = sum;
                    sum = f0 + f1;
                    k++;
                }

                if (k > maxk) {
                    maxk = k;
                    mf0 = a[i];
                    mf1 = a[j];
                }
            }
        }

        Integer idx = h.get((long)0);
        if (idx != null && cnt[idx]>maxk) {
            maxk = cnt[idx];
        }

        /*

        long f0 = mf0; h.put(f0, h.get(f0)-1);
        long f1 = mf1; h.put(f1, h.get(f1)-1);
        for (int i = 3; i < maxk; i++) {
            long sum = f0+f1;
            Integer amount = h.get(sum);
            if (amount == null || amount <=0)
                throw new Exception("Not correct");
            else {
                h.put(sum, --amount);
                f0 = f1;
                f1 = sum;
            }
        }
*/


        System.out.println(maxk);

    }

}
