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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author AlexFetisov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD_IR_V2 solver = new TaskD_IR_V2();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD_IR_V2 {
        private static final int MAX = (int) 1e9;
        private HashMap<Integer, Integer> A;
        private int[] a;
        private int n;
        private HashSet<Long> dict;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            a = Utils.readIntArray(in, n);
            Arrays.sort(a);
            int count0 = 0;
            A = new HashMap<Integer, Integer>();
            for (int i : a) {
                if (i == 0) ++count0;
                putToMap(i);
            }
            int res = Math.max(count0, 2);

            dict = new HashSet<Long>();
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < i; ++j) {
                    if (a[i] == 0 && a[j] == 0) continue;

                    if (dict.contains((a[i] * 1L * (MAX + 1)) + a[j])) continue;

                    res = Math.max(res, process(a[i], a[j]));

                    if (dict.contains((a[j] * 1L * (MAX + 1)) + a[i])) continue;
                    res = Math.max(res, process(a[j], a[i]));
                }
            }

            out.println(res);
        }

        private int process(int a, int b) {
            List<Integer> list = new ArrayList<Integer>();
            list.add(a);
            list.add(b);

            dict.add((a * 1L * (MAX + 1)) + b);

            removeDict(a);
            removeDict(b);

            int x = a, y = b;
            int cur = 2;
            while (true) {
                int nxt = x + y;
                if (Math.abs(nxt) > MAX) break;
                if (!A.containsKey(nxt)) break;
                removeDict(nxt);
                list.add(nxt);
                dict.add((y * 1L * (MAX + 1)) + nxt);
                x = y;
                y = nxt;
                ++cur;
            }

            x = a;
            y = b;
            while (true) {
                int nxt = y - x;
                if (Math.abs(nxt) > MAX) break;
                if (!A.containsKey(nxt)) break;
                removeDict(nxt);
                list.add(nxt);
                dict.add(nxt * 1L * (MAX + 1) + x);

                y = x;
                x = nxt;
                ++cur;
            }

            for (int i : list) {
                putToMap(i);
            }

            return cur;
        }

        private void putToMap(int x) {
            if (A.containsKey(x)) {
                A.put(x, A.get(x) + 1);
            } else {
                A.put(x, 1);
            }
        }

        private void removeDict(int x) {
            if (A.get(x) == 1) {
                A.remove(x);
            } else {
                A.put(x, A.get(x) - 1);
            }
        }

    }

    static class Utils {
        public static int[] readIntArray(InputReader in, int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
            }
            return a;
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String nextString() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}

