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.
/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class Fibonacci_Ish {
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int N = sc.nextInt();

        int[] a = new int[N];
        HashMap<Integer, Integer> valToIdx = new HashMap<>();
        HashMap<Integer, Integer> freq = new HashMap<>();
        ArrayList<Integer> vals = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            a[i] = sc.nextInt();
            if (!valToIdx.containsKey(a[i])) {
                valToIdx.put(a[i], vals.size());
                vals.add(a[i]);
            }
            freq.merge(a[i], 1, Integer::sum);
        }
        // N(N-1) = O(N^2) pairs, and if we ever reach a state where we've
        // seen it before, then we can just use that answer
        N = vals.size();
        /*
        -1 1 0 1 1
        NOTHING CAN BE CYCLICAL
        We can guess that the fibonacci grows like 1.618^n, so this complexity is N^2 * 9 / log(1.618)
        1 -1 0 -1 -1 -2 -3 -5...
        -2 2 0 2 2 4 6, ...
         */
        int ans = 2;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                // consider these as the start state!
                if (i != j || freq.get(vals.get(i)) >= 2) {
                    HashMap<Integer, Integer> usedFreq = new HashMap<>();
                    int k;
                    int len = 2;
                    int prev = i;
                    int curr = j;
                    usedFreq.merge(vals.get(prev), 1, Integer::sum);
                    usedFreq.merge(vals.get(curr), 1, Integer::sum);
                    while ((k = valToIdx.getOrDefault(vals.get(prev) + vals.get(curr), -1)) != -1 && freq.get(vals.get(k)) > usedFreq.getOrDefault(vals.get(k), 0)) {
                        len++;
                        prev = curr;
                        curr = k;
                        usedFreq.merge(vals.get(k), 1, Integer::sum);
                    }
                    if (len > ans) {
                        ans = len;
                    }
                }
            }
        }
        out.println(ans);
        out.close();
    }

    static class FastScanner {
        private int BS = 1<<16;
        private char NC = (char)0;
        private byte[] buf = new byte[BS];
        private int bId = 0, size = 0;
        private char c = NC;
        private double cnt = 1;
        private BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) {
            try {
                in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
            }
            catch (Exception e) {
                in = new BufferedInputStream(System.in, BS);
            }
        }

        private char getChar(){
            while(bId==size) {
                try {
                    size = in.read(buf);
                }catch(Exception e) {
                    return NC;
                }
                if(size==-1)return NC;
                bId=0;
            }
            return (char)buf[bId++];
        }

        public int nextInt() {
            return (int)nextLong();
        }

        public int[] nextInts(int N) {
            int[] res = new int[N];
            for (int i = 0; i < N; i++) {
                res[i] = (int) nextLong();
            }
            return res;
        }

        public long[] nextLongs(int N) {
            long[] res = new long[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long nextLong() {
            cnt=1;
            boolean neg = false;
            if(c==NC)c=getChar();
            for(;(c<'0' || c>'9'); c = getChar()) {
                if(c=='-')neg=true;
            }
            long res = 0;
            for(; c>='0' && c <='9'; c=getChar()) {
                res = (res<<3)+(res<<1)+c-'0';
                cnt*=10;
            }
            return neg?-res:res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c!='.' ? cur:cur+nextLong()/cnt;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=getChar();
            while(c>32) {
                res.append(c);
                c=getChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while(c<=32)c=getChar();
            while(c!='\n') {
                res.append(c);
                c=getChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if(c>32)return true;
            while(true) {
                c=getChar();
                if(c==NC)return false;
                else if(c>32)return true;
            }
        }
    }
}