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.
//package fibonacci;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Test {

	/**
	 * @param args
	 */

	static int[] filter(int t[], int size) {
		int i = 0, res[] = new int[size];
		for (int v : t) {
			if (i >= size)
				break;
			res[i++] = v;
		}
		return res;
	}

	static void alnaser() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Integer a[] = new Integer[n];
		int neg=0;

		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			if(a[i]<0)
				neg++;
		}
		Arrays.sort(a);
		for (int i : a)
			System.out.print(i + ",");
		System.out.println();
		if(neg>0)
			Arrays.sort(a, 0, neg, Collections.reverseOrder());
		// Arrays.sort(a);
		for (int i : a)
			System.out.print(i + ",");
		System.out.println();
		List<int[]> list = new ArrayList<>();
		for (int i = 0; i < n - 1; i++) {
			for (int j = 0; j < n; j++) {
				if (i != j) {
					int i1 = 2, inc = 0, tab[] = new int[n];
					tab[0] = a[i];
					tab[1] = a[j];
					while (inc < n) {
						if (tab[i1 - 2] + tab[i1 - 1] != a[inc]) {
							inc++;
							continue;
						}
						tab[i1++] = a[inc++];
					}
					// for(int x:tab)
					// System.out.print(x+",");
					// System.out.println();
					list.add(filter(tab, i1));
				}
			}
		}
		int max = 0;
		for (int[] t : list) {
			if (max < t.length)
				max = t.length;
			// for (int i : t) {
			// System.out.print(i + ",");
			// }
			// System.out.println();
		}

		System.out.println(max);

	}

	public static void main(String[] args) {

		solve();
		//alnaser();

	}

	static int[] remove(int[] a) {
		ArrayList<Integer> res = new ArrayList<>();
		for (int x : a) {
			int sz = res.size();
			if (sz >= 3 && res.get(sz - 1) == x && res.get(sz - 2) == x
					&& res.get(sz - 3) == x) {
				continue;
			}
			res.add(x);
		}
		int[] result = new int[res.size()];
		for (int i = 0; i < result.length; i++) {
			result[i] = res.get(i);
		}
		return result;
	}

	static void solve() {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
		}
		Arrays.sort(a);
		int cnt0 = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] == 0) {
				cnt0++;
			}
		}
		int res = Math.max(cnt0, 2);
		a = remove(a);

		n = a.length;
		int[][] go = new int[n][n];
		for (int i = 0; i < n; i++) {
			int it = 0;
			for (int j = 0; j < n; j++) {
				int need = a[i] + a[j];
				while (it < n && a[it] < need) {
					it++;
				}
				go[i][j] = it;
			}
		}
		// for (int i[] : go) {
		// for (int j : i) {
		// System.out.format("%3d", j);
		// }
		// System.out.println();
		// }
		int[] lastTime = new int[n];
		int time = 0;
		for (int f = 0; f < n; f++) {
			for (int s = 0; s < n; s++) {
				if (f != s && (a[f] != 0 || a[s] != 0)) {
					time++;
					lastTime[f] = time;
					lastTime[s] = time;
					int c1 = f, c2 = s;
					int sz = 2;
					while (true) {
						int ne = go[c1][c2];
						int need = a[c1] + a[c2];
						while (ne < n && a[ne] == need && lastTime[ne] == time) {
							ne++;
						}
						if (ne < n && a[ne] == need && lastTime[ne] < time) {
							c1 = c2;
							c2 = ne;
							lastTime[ne] = time;
							sz++;
						} else {
							break;
						}
					}
					
					res = Math.max(res, sz);
				}
			}
		}
		System.out.println(res);
	}

}
