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.
def main():
  n = int(input())
  vec = map(int, raw_input().split())
  fib_list = [0]*n
  num_occur = {}
  pair_occur = {}


  for x in range(n):
    num_occur[vec[x]] = 0
  for x in range(n):
    num_occur[vec[x]] += 1

  for x in range(n):
    for y in range(n):
      pair_occur[(vec[x], vec[y])] = 0

  prefix_num = 2
  i = 0

  for x in range(n):
    for y in range(n):
      if(x == y or pair_occur[(vec[x], vec[y])]):
        continue

      pair_occur[(vec[x], vec[y])] = 1
      prefix_num_aux = 2
      n1 = vec[x]
      n2 = vec[y]
      fib_list[i] = n1
      fib_list[i+1] = n2
      i += 2

      num_occur[n1] -= 1
      num_occur[n2] -= 1
        
      while((n1+n2) in num_occur and num_occur[n1+n2] > 0):
        num_occur[n1+n2] -= 1

        aux = n1
        n1 = n2
        n2 = aux

        n2 += n1
        prefix_num_aux += 1
        fib_list[i] = n2
        i += 1

        pair_occur[(n1, n2)] = 1

      prefix_num = max(prefix_num, prefix_num_aux)

      if(prefix_num == n):
        break

      for z in range(i):
        num_occur[fib_list[z]] += 1

      i = 0

    if(prefix_num == n):
      break

  return prefix_num

print(main())