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.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;

public class MainD {
	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt();
		int[] a = new int[n];
		int M = 1000000000;
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		Set<Long> cash = new HashSet<Long>();
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			map.put(a[i], map.containsKey(a[i]) ? map.get(a[i]) + 1 : 1);
		}
		int longest = Math.max(2, map.containsKey(0) ? map.get(0) : 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;
				if (cash.contains(a[i] + (1L * a[j] * M))) continue;
				Map<Integer, Integer> use = new HashMap<Integer, Integer>();
				int step = 2;
				int pre1 = a[i];
				int pre2 = a[j];
				int next = pre1 + pre2;
				use.put(pre1, 1);
				use.put(pre2, 1);
				while (true) {
					if (!map.containsKey(next) || (use.containsKey(next) && map.get(next) - use.get(next) <= 0)) {
						break;
					}
					use.put(next, use.containsKey(next) ? use.get(next) + 1 : 1);
					step++;
					int tmp = pre2;
					pre1 = pre2;
					pre2 = next;
					next += tmp;
				}
				cash.add(a[i] + (1L * a[j] * M));
				longest = Math.max(longest, step);
			}
		}
		System.out.println(longest);
	}

	public static void main(String[] args) {
		new MainD().run();
	}
}