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.math.BigInteger;
import java.util.*;

/**
 * @author ramilagger
 */
public class Main {

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

    class Pair implements Comparable<Pair> {
        int x,y;

        Pair(int a, int b){
            x = a;
            y = b;
        }

        @Override
        public int compareTo(Pair o) {
            if(Integer.compare(o.x,x) == 0) return Integer.compare(o.y,y);
            return Integer.compare(o.x,x);
        }
    }
    int binarySearch(int c,int[] a) {
        int lo = 0;
        int hi = a.length - 1;
        int index = -1;
        while(hi >= lo) {
            int mid = lo + (hi - lo) / 2;
            if(c == a[mid]) {
                index = mid;
                hi = mid - 1;
            }
            else if(a[mid] < c)
                lo = mid + 1;
            else
                hi = mid - 1;
        }
        return index;
    }

    void solve() {
        int n = nextInt();
        int[] nums = nextArray(n);
        Arrays.sort(nums);
        int res = 0;
        int st = binarySearch(0,nums);
        for (int i = st == -1 ? n : st; i < n; i++)
            if(nums[i] == 0)
                res++;
        int a,b,temp,cnt,ind;
        res = Math.max(2,res);
        TreeSet<Pair> set = new TreeSet<>();
        boolean[] used = new boolean[n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (i != j && (nums[j] != 0 || nums[i] != 0) && !set.contains(new Pair(nums[i],nums[j]))) {
                    set.add(new Pair(nums[i],nums[j]));
                    a = nums[i];
                    b = nums[j];
                    Arrays.fill(used,false);
                    used[i] = true;
                    used[j] = true;
                    temp = a + b;
                    cnt = 2;
                    while (true) {
                        ind = binarySearch(temp, nums);
                        if(ind > -1 && used[ind]) {
                            while (ind + 1 < n && used[ind + 1])
                                ind++;
                            ind++;
                        }
                        if(ind > -1 && ind < n && nums[ind] == temp && !used[ind]) {
                            cnt++;
                            used[ind] = true;
                            a = b;
                            b = temp;
                            temp = a + b;
                        }else {
                            res = Math.max(res,cnt);
                            break;
                        }
                    }
                }
            }
        }
        pw.println(res);
    }


    public void run() throws IOException {
        start = System.currentTimeMillis();
        solve();
        if (!ONLINE_JUDGE)
            System.err.println(System.currentTimeMillis() - start + " ms");
        br.close();
        pw.close();
    }

    public Main() {
        try {
            br = (ONLINE_JUDGE) ? new BufferedReader(new InputStreamReader(System.in))
                    : new BufferedReader(new FileReader("in.txt"));
            pw = (ONLINE_JUDGE) ? new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)))
                    : new PrintWriter(new BufferedWriter(new FileWriter("out.txt")));
            this.run();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException();
        }
    }

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


    public boolean hasNext() {
        if (st != null && st.hasMoreTokens())
            return true;
        try {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
        } catch (Exception e) {
            return false;
        }
        return true;
    }

    public String next() {
        if (hasNext()) return st.nextToken();
        return null;
    }

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

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

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

    public BigInteger nextBigInteger() {
        return new BigInteger(next());
    }

    public String nextLine() {
        StringBuilder sb;
        try {
            while (st == null || !st.hasMoreTokens()) return br.readLine();
            sb = new StringBuilder(st.nextToken());
            while (st.hasMoreTokens()) sb.append(" " + st.nextToken());
        } catch (IOException e) {
            throw new RuntimeException();
        }
        return sb.toString();
    }

    public int[] nextArray(int n) {
        int[] temp = new int[n];
        for (int i = 0; i < n; i++)
            temp[i] = nextInt();
        return temp;
    }

    public long[] nextLArray(int n) {
        long[] temp = new long[n];
        for (int i = 0; i < n; i++)
            temp[i] = nextLong();
        return temp;
    }

    long start;
    final BufferedReader br;
    final PrintWriter pw;
    StringTokenizer st;

}