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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Map.Entry;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskD {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			int[] a = new int[n];
			int res = 0;
			Map<Integer, Integer> m = new HashMap<>();
			for (int i = 0; i < n; i++) {
				a[i] = in.nextInt();
				if (a[i] == 0) ++res;
				Integer cnt = m.get(a[i]);
				if (cnt == null) cnt = 0;
				m.put(a[i], cnt + 1);
			}
			n = 0;
			for (Map.Entry<Integer, Integer> e : m.entrySet()) {
				a[n++] = e.getKey();
				if (e.getValue() > 1)
					a[n++] = e.getKey();
			}
			res = Math.max(res, 2);
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (i == j) continue;
					int f0 = a[i];
					int f1 = a[j];
					if (f0 == 0 && f1 == 0) continue;
					m.put(f0, m.get(f0) - 1);
					m.put(f1, m.get(f1) - 1);
					int cnt = 2;
					while (true) {
						int f = f0 + f1;
						Integer v = m.get(f);
						if (v == null || v == 0) {
							break;
						}
						m.put(f, m.get(f) - 1);
						f0 = f1;
						f1 = f;
						++cnt;
					}
					res = Math.max(res, cnt);
					f0 = a[i];
					m.put(f0, m.get(f0) + 1);
					f1 = a[j];
					m.put(f1, m.get(f1) + 1);
					while (cnt-- > 2) {
						int f = f0 + f1;
						m.put(f, m.get(f) + 1);
						f0 = f1;
						f1 = f;
					}
				}
			}

			out.println(res);
		}

	}

	static class InputReader {
		final InputStream is;
		final byte[] buf = new byte[1024];
		int pos;
		int size;

		public InputReader(InputStream is) {
			this.is = is;
		}

		public int nextInt() {
			int c = read();
			while (isWhitespace(c))
				c = read();
			int sign = 1;
			if (c == '-') {
				sign = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = read();
			} while (!isWhitespace(c));
			return res * sign;
		}

		int read() {
			if (size == -1)
				throw new InputMismatchException();
			if (pos >= size) {
				pos = 0;
				try {
					size = is.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (size <= 0)
					return -1;
			}
			return buf[pos++] & 255;
		}

		static boolean isWhitespace(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

	}
}

