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.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class Cf633D {
    public static void main(String[] args) throws Exception {
        Scanner cin = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter cout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = cin.nextInt();
        int[] a = new int[n];
        Map<Integer, Integer> num = new HashMap<>();
        long minA = Integer.MAX_VALUE;
        long maxA = Integer.MIN_VALUE;
        for (int i = 0; i < n; i++) {
            a[i] = cin.nextInt();
            minA = Math.min(minA, a[i]);
            maxA = Math.max(maxA, a[i]);
            if (!num.containsKey(a[i])) {
                num.put(a[i], 1);
            } else {
                num.put(a[i], num.get(a[i]) + 1);
            }
        }
        Arrays.sort(a);
        List<Integer> used = new ArrayList<>(n);
        Set<Pair> tried = new HashSet<>();
        int maxRez = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i == j) continue;
                Pair pp = new Pair(a[i], a[j]);
                if (tried.contains(pp)) {
                    continue;
                }
                long u = a[i];
                long v = a[j];
                num.put(a[i], num.get(a[i]) - 1);
                num.put(a[j], num.get(a[j]) - 1);
                used.add(a[i]);
                used.add(a[j]);
                int rez = 2;
                while (true) {
                    long c = u + v;
                    int cc = (int) c;
                    if (minA <= c && c <= maxA && num.containsKey(cc) && num.get(cc) > 0) {
                        num.put(cc, num.get(cc) - 1);
                        used.add(cc);
                        rez++;
                        u = v;
                        v = c;
                    } else {
                        maxRez = Math.max(maxRez, rez);
                        for (Integer t : used) {
                            num.put(t, num.get(t) + 1);
                        }
                        used.clear();
                        tried.add(pp);
                        break;
                    }
                }
            }
        }
        cout.println(maxRez);
        cout.close();
    }

    private static class Pair {
        public final int first;
        public final int second;

        public Pair(int first, int second) {
            this.first = first;
            this.second = second;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Pair pair = (Pair) o;
            return first == pair.first && second == pair.second;
        }

        @Override
        public int hashCode() {
            int result = first;
            result = 31 * result + second;
            return result;
        }
    }
}
