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.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

public class Fibonanciish {
	public static void main(String[] args) throws IOException {
		InputReader r = new InputReader(System.in);
		int n = r.nextInt();
		int[] arr = new int[n];
		HashMap<Long, Integer> set = new HashMap<Long, Integer>();
		int zeros = 0;
		HashSet<Integer> unique = new HashSet<Integer>();
		for (int i = 0; i < arr.length; i++) {
			arr[i] = r.nextInt();
			unique.add(arr[i]);
			long x = 1L * arr[i];
			if (!set.containsKey(x))
				set.put(x, 0);
			set.put(x, set.get(x) + 1);
			if (arr[i] == 0)
				zeros++;
		}
		int max = zeros;
		for (int x:unique) {
			for (int y:unique) {
				long[] a = new long[90];
				Arrays.fill(a, Long.MAX_VALUE);
				a[0] = x;
				a[1] = y;
				for (int k = 2; k < a.length; k++) {
					a[k] = a[k - 1] + a[k - 2];
					if (a[k] < Integer.MIN_VALUE || a[k] > Integer.MAX_VALUE)
						break;
				}
				int found = 0;
				for (int k = 0; k < a.length; k++) {
					if (a[k] == Long.MAX_VALUE)
						break;
					if (set.containsKey(a[k])) {
						int cnt = set.get(a[k]);
						set.put(a[k], set.get(a[k]) - 1);
						if (cnt > 0) {
							found++;
						}
					} else
						break;
				}
				for (int k = 0; k < a.length; k++) {
					if (a[k] == Long.MAX_VALUE)
						break;
					if (set.containsKey(a[k])) {
						set.put(a[k], set.get(a[k]) + 1);
					} else
						break;
				}
				max = Math.max(max, found);

			}
		}
		System.out.println(max);
	}

	static class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}

		public InputReader(FileReader stream) {
			reader = new BufferedReader(stream);
			tokenizer = null;
		}

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

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

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