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.*;
import java.util.*;

public class D {
	public static void main(String[] args) throws IOException, NumberFormatException {
		BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		Scanner s = new Scanner(System.in);

		int n = Integer.parseInt(f.readLine().trim());
		String[] split = f.readLine().split("\\s+");
		long start = System.currentTimeMillis();
		long[] a = new long[n];
		TreeMap<Long, Integer> freq = new TreeMap<>();
		TreeSet<Long> has = new TreeSet<>();
		int[] frequency = new int[1010];
		int zeroCount = 0, index = 0;
		long ma = Integer.MIN_VALUE;
		for(int i= 0; i < n; i++) {
			a[i] = Long.parseLong(split[i]);
			if(!has.contains(a[i])) {
				has.add(a[i]);
				freq.put(a[i], index++);
				frequency[freq.get(a[i])]++;
			}
			else {
				frequency[freq.get(a[i])]++;
			}
			if(a[i] == 0) zeroCount++;
			ma = Math.max(ma, a[i]);
		}
		TreeMap<Long, Long> memo = new TreeMap<>();
		int max = 2;
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < n; j++) {
				if(i == j) continue;
				long f1 = a[i], f2 = a[j];
				if(memo.containsKey(f1) && memo.get(f1) == f2) continue;
				if(f1 == 0 && f2 == 0) {
					max = Math.max(max, zeroCount);
					continue;
				}
				long last = f2, tHold = f2;
				int cur = 2;
				int[] frequ = new int[1010];
				frequ[freq.get(f1)]++; frequ[freq.get(f2)]++;
				for(long k = f1+f2; k <= ma; k+=last) {
					last = tHold;
					if(has.contains(k)) {
						int idx = freq.get(k);
						if(frequ[idx] == 0) {
							frequ[idx]++;
							cur++;
						} else if(frequ[idx]+1 <= frequency[idx]) {
							 cur++;
							 frequ[idx]++;
						} else break;
					} else break;
					tHold = k;
				}
				max = Math.max(max, cur);
				memo.put(f1, f2);
			}
		}
		System.out.println(max);
//		System.out.println(System.currentTimeMillis()-start);
	}
}