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.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

public class P633D {

	static class Pair implements Comparable<Pair> {
		public long x;
		public long y;

		Pair(long x, long y) {
			this.x = x;
			this.y = y;
		}

		@Override
		public int compareTo(Pair other) {
			if (x != other.x) {
				if (x < other.x)
					return -1;
				else
					return 1;
			}
			if (y != other.y) {
				if (y < other.y)
					return -1;
				else
					return 1;
			}
			return 0;
		}

		@Override
		public int hashCode() {
			return (int) (x + y) % 1000000;
		}

		@Override
		public boolean equals(Object other) {
			return this.compareTo((Pair) other) == 0;
		}
	}

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//		BufferedReader br = new BufferedReader(new FileReader("input.txt"));
		int n = Integer.parseInt(br.readLine());
		long[] a = new long[n];
		StringTokenizer tk = new StringTokenizer(br.readLine());
		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(tk.nextToken());
//			System.out.println(a[i]);
		}

		List<Long> c = new ArrayList<>();
		Map<Long, Integer> cnt = new HashMap<>();
		for (int i = 0; i < n; i++) {
			if (!cnt.containsKey(a[i])) {
				cnt.put(a[i], 1);
			} else {
				cnt.put(a[i], cnt.get(a[i]) + 1);
			}
			if (cnt.get(a[i]) <= 2) {
				c.add(a[i]);
			}
		}
//		System.out.println(cnt);

//		Set<Pair> s = new HashSet<>();
		int maxi = 0;
		if (cnt.containsKey(0L)) {
			maxi = cnt.get(0L);
		}
		for (int i = 0; i < c.size(); i++) {
//			System.out.println("xx" + cnt);
			for (int j = 0; j < c.size(); j++) {
				if (j == i) {
					continue;
				}
				if (c.get(i) == 0 && c.get(j) == 0) {
					continue;
				}
//				if (s.contains(new Pair(a[i], a[j]))) {
//					continue;
//				}
				cnt.put(c.get(i), cnt.get(c.get(i)) - 1);
				cnt.put(c.get(j), cnt.get(c.get(j)) - 1);
				List<Long> b = new ArrayList<>();
				b.add(c.get(i));
				b.add(c.get(j));
//				s.add(new Pair(a[i], a[j]));

				long x = c.get(i);
				long y = c.get(j);
				while (true) {
					long z = x + y;
					if (cnt.containsKey(z) && cnt.get(z) > 0) {
						cnt.put(z, cnt.get(z) - 1);
						b.add(z);
//						s.add(new Pair(y, z));
					} else {
						break;
					}
					x = y;
					y = z;
				}

//				x = a[i];
//				y = a[j];
//				while (true) {
//					long z = y - x;
//					if (cnt.containsKey(z) && cnt.get(z) > 0) {
//						cnt.put(z, cnt.get(z) - 1);
//						b.add(z);
//						s.add(new Pair(z, x));
//					} else {
//						break;
//					}
//					y = x;
//					x = z;
//				}

				if (maxi < b.size()) {
//					System.out.println(b);
					maxi = b.size();
				}
				for (long z : b) {
					cnt.put(z, cnt.get(z) + 1);
				}
//				System.out.println("day ne: " + cnt);
			}
		}
		System.out.println(maxi);
	}

}
