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.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;


public class D {

	static StringTokenizer st;
	static BufferedReader br;
	static PrintWriter pw;
	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int n = nextInt();
		int[]a = new int[n+1];
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			a[i] = nextInt();
			if (a[i]==0)
				ans++;
		}
		Arrays.sort(a, 1, n+1);
		int[]f = new int[n+1];
		int INF = (int) 2e9;
		int[]cnt = new int[20000];
		int last = 1;
		cnt[1] = 1;
		int[]new_val = new int[n+1];
		new_val[1] = 1;
		for (int i = 2; i <= n; i++) {
			if (a[i] != a[i-1])
				last++;
			cnt[last]++;
			new_val[i] = last;
		}
		int[]removed = new int[n+1];
		int size = 0;
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (i==j)
					continue;
				for (int j2 = 1; j2 <= size; j2++) {
					cnt[removed[j2]]++;
				}
				size = 0;
				f[1] = a[i];
				f[2] = a[j];
				if (f[1]==0 && f[2]==0)
					continue;
				size++;
				removed[size] = new_val[i];
				size++;
				removed[size] = new_val[j];
				cnt[new_val[i]]--;
				cnt[new_val[j]]--;
				int leng = 2;
				for (int j2 = 3; j2 <= n; j2++) {
					long r = (long)f[j2-2] + f[j2-1];
					if (r > INF || r < -INF)
						break;
					f[j2] = (int) r;
					int left = 1, right = n+1;
					while (right-left > 1) {
						int mid = (left+right) >> 1;
						if (a[mid] > f[j2])
							right = mid;
						else
							left = mid;
					}
					if (a[left]==f[j2] && cnt[new_val[left]] > 0) {
						leng++;
						cnt[new_val[left]]--;
						removed[++size] = new_val[left];
					}
					else
						break;
				}
				if (leng > ans)
					ans = leng;
			}
		}
		System.out.println(ans);
		pw.close();
	}
	private static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
	private static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
	private static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}
	private static String next() throws IOException {
		while (st==null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}
}
