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.util.*;

import static java.lang.Math.*;


public class Main {
    FastScanner in;
    PrintWriter out;

    static final String FILE = "";

    TreeMap<Integer, Integer> map = new TreeMap<>();

    int getCnt(int v) {
        return map.getOrDefault(v, 0);
    }

    void minus(int v) {
        int cnt = map.get(v);
        if (cnt == 1)
            map.remove(v);
        else
            map.put(v, cnt - 1);
    }

    void plus(int v) {
        map.put(v, map.getOrDefault(v, 0) + 1);
    }

    int n;
    int ms[];

    int calc(int a, int b) {
        minus(a);
        minus(b);

        int la = a, lb = b;

        int cnt = 2;
        while (true) {
            int nw = a + b;
            a = b;
            b = nw;
            if (getCnt(b) == 0)
                break;
            cnt++;
            minus(b);
        }

        a = la;
        b = lb;
        plus(a);
        plus(b);
        for (int v = 2; v < cnt; v++) {
            int nw = a + b;
            a = b;
            b = nw;
            plus(b);
        }

        return cnt;
    }

    public void solve() {
        n = in.nextInt();
        ms = new int[n];
        for (int i = 0; i < n; i++)
            ms[i] = in.nextInt();

        for (int i = 0; i < n; i++)
            plus(ms[i]);

        int maxi = 0;
        TreeSet<Pair<Integer, Integer>> set = new TreeSet<>();
        for (int i = 0; i < n; i++) {
            for (int z = 0; z < n; z++) {
                if (i == z)
                    continue;
                Pair<Integer, Integer> pair = new Pair<>(ms[i], ms[z]);
                if (set.contains(pair))
                    continue;
                set.add(pair);
                maxi = max(maxi, calc(ms[i], ms[z]));
            }
        }

        out.print(maxi);
    }

    public void run() {
        if (FILE.equals("")) {
            in = new FastScanner(System.in);
            out = new PrintWriter(System.out);
        } else {
            try {
                in = new FastScanner(new FileInputStream(FILE +
                        ".in"));
                out = new PrintWriter(new FileOutputStream(FILE +
                        ".out"));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }
        solve();
        out.close();
    }

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

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

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

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
                return "";
            }
        }

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

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

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

        public float nextFloat() {
            return Float.parseFloat(next());
        }
    }

    class Pair<A extends Comparable<A>, B extends Comparable<B>>
            implements Comparable<Pair<A, B>> {
        public A a;
        public B b;

        public Pair(A a, B b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Pair<A, B> o) {
            if (o == null || o.getClass() != getClass())
                return 1;
            int cmp = a.compareTo(o.a);
            if (cmp == 0)
                return b.compareTo(o.b);
            return cmp;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair<?, ?> pair = (Pair<?, ?>) o;

            if (a != null ? !a.equals(pair.a) : pair.a != null) return
                    false;
            return !(b != null ? !b.equals(pair.b) : pair.b != null);
        }
    }

    class PairInt extends Pair<Integer, Integer> {
        public PairInt(Integer u, Integer v) {
            super(u, v);
        }
    }

    class PairLong extends Pair<Long, Long> {
        public PairLong(Long u, Long v) {
            super(u, v);
        }
    }

}