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.
//package javaapplication5;

import java.io.*;
import java.util.*;
 
public class utkarsh {
    
    BufferedReader br;
    PrintWriter out;
    
    long mod = (long) (1e9 + 7), inf = (long) (3e18);
    
    void solve() {
        int n = ni();
        int a[] = new int[n];
        for(int i = 0; i < n; i++)  a[i] = ni();
        HashMap <Integer, Integer> mp = new HashMap<>();
        int ans = 0;
        for(int i = 0; i < n; i++) {
            mp.put(a[i], mp.getOrDefault(a[i], 0) + 1);
            if(a[i] == 0)   ans++;
        }
        int undo[] = new int[n];
        int ind = 0;
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                if(i == j || (a[i] == 0 && a[j] == 0))   continue;
                ind = 0;
                int x = a[i], y = a[j];
                mp.put(x, mp.get(x) - 1);   undo[ind++] = x;
                mp.put(y, mp.get(y) - 1);   undo[ind++] = y;
                int sz = 2;
                while(true) {
                    int z = x + y;
                    if(mp.getOrDefault(z, 0) == 0) break;
                    mp.put(z, mp.get(z) - 1);   undo[ind++] = z;
                    x = y;  y = z;
                    sz++;
                }
                ans = Math.max(ans, sz);
                for(int k = 0; k < ind; k++)    mp.put(undo[k], mp.get(undo[k]) + 1);
            }
        }
        out.println(ans);
    }
    
    long mp(long b, long e) {
        long r = 1;
        while(e > 0) {
            if( (e&1) == 1 )    r = (r * b) % mod;
            b = (b * b) % mod;
            e >>= 1;
        }
        return r;
    }
    
    // -------- I/O Template -------------
    
    char nc() {
        return ns().charAt(0);
    }
    
    String nLine() {
        try {
            return br.readLine();
        } catch(IOException e) {
            return "-1";
        }
    }
    
    double nd() {
        return Double.parseDouble(ns());
    }
    
    long nl() {
        return Long.parseLong(ns());
    }
    
    int ni() {
        return Integer.parseInt(ns());
    }
    
    StringTokenizer ip;
    
    String ns() {
        if(ip == null || !ip.hasMoreTokens()) {
            try {
                ip = new StringTokenizer(br.readLine());
            } catch(IOException e) {
                throw new InputMismatchException();
            }
        }
        return ip.nextToken();
    }
    
    void run() {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        solve();
        out.flush();
    }
    
    public static void main(String[] args) {
        new utkarsh().run();
    }
}
