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

public class D implements Runnable {

    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer tok = new StringTokenizer("");

    private void init() throws FileNotFoundException {
        Locale.setDefault(Locale.US);
        String fileName = "";
        if (ONLINE_JUDGE && fileName.isEmpty()) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            if (fileName.isEmpty()) {
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new PrintWriter(fileName + ".out");
            }
        }
    }

    String readString() {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    long readLong() {
        return Long.parseLong(readString());
    }

    double readDouble() {
        return Double.parseDouble(readString());
    }

    int[] readIntArray(int size) {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = readInt();
        }
        return a;
    }

    public static void main(String[] args) {
        //new Thread(null, new _Solution(), "", 128 * (1L << 20)).start();
        new D().run();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    @Override
    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            init();
            solve();
            out.close();
            time();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    int countOfZeroes;
    int answer = 2;

    void calculate(Map<Long, Integer> mapCount, long fi, long fj) {
        int length = 2;
        Map<Long, Integer> curCount = new HashMap<>();
        curCount.put(fi, 1);
        curCount.put(fj, fi == fj ? 2 : 1);
        long fnext = fi + fj;
        while (true) {
            Integer curCountNext = curCount.get(fnext);
            Integer countNext = mapCount.get(fnext);
            if (countNext != null && (curCountNext == null || curCountNext + 1 <= countNext)) {
                curCount.put(fnext, (curCountNext == null ? 1 : curCountNext + 1));
                length++;
                answer = Math.max(answer, length);
                fi = fj;
                fj = fnext;
                fnext = fi + fj;
            } else {
                break;
            }
        }
    }

    private void solve() {
        int n = readInt();

        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int x = readInt();
            if (x == 0) {
                countOfZeroes++;
                if (countOfZeroes == 1) {
                    list.add(x);
                }
            } else {
                list.add(x);
            }
        }
        n = list.size();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = list.get(i);
        }

        Map<Long, Integer> mapCount = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int count;
            if (mapCount.containsKey((long)a[i])) {
                count = mapCount.get((long)a[i]);
            } else {
                count = 0;
            }
            mapCount.put((long) a[i], count + 1);
        }

        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i == j) {
                    continue;
                }
                calculate(mapCount, a[i], a[j]);
            }
        }
        out.println(Math.max(answer, countOfZeroes));
    }
}
