633_D. Fibonacci-ish
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.
```python
import random, math
from copy import deepcopy as dc
from bisect import bisect_left, bisect_right
from collections import Counter


# Function to call the actual solution
def solution(li):
	ma = {}
	for i in range(len(li)):
		ma[li[i]] = ma.get(li[i], 0) + 1
	# ma1 = dc(ma)
	ans = 0
	# li = list(set(li))
	for i in range(len(li)):
		for j in range(len(li)):
			if i != j:
				f0 = li[i]
				f1 = li[j]
				if f0 == 0 and f1 == 0:
					ans = max(ans, ma[0])
					continue

				ma[f0] -= 1
				ma[f1] -= 1
				cur = 2
				while True:
					nxt = f0 + f1
					if nxt in ma and ma[nxt] > 0:
						f0 = f1 + 1 - 1
						f1 = nxt + 1 - 1
						ma[nxt] -= 1
						cur += 1
					else:
						break
				cur1 = 2
				ma[f0] += 1
				ma[f1] += 1
				while cur1 < cur:
					prev = f1 - f0
					f1 = f0 + 1 - 1
					f0 = prev + 1 - 1
					ma[prev] += 1
					cur1 += 1
				ans = max(ans, cur)
	return ans


# Function to take input
def input_test():
		n = int(input())
		li = list(map(int, input().strip().split(" ")))
		out = solution(li)
		print(out)

# Function to test my code
def test():
	pass


input_test()
# test()
```