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.
#include <bits/stdc++.h>
using namespace std;
map<long long, int> s;
bool t[1001][1001];
int tt[1001];
long long a[1001], i, j, n, k, Max, x, length;
int Long(int x, int y) {
  t[x][y] = true;
  tt[x]--;
  tt[y]--;
  int i = x;
  int j = y;
  int k = s[a[i] + a[j]];
  int ans = 2;
  while (k && tt[k]) {
    ans++;
    i = j;
    j = k;
    tt[k]--;
    k = s[a[i] + a[j]];
    t[i][j] = true;
  }
  i = x;
  j = y;
  k = s[a[j] - a[i]];
  while (k && tt[k]) {
    ans++;
    tt[k]--;
    j = i;
    i = k;
    k = s[a[j] - a[i]];
    t[i][j] = true;
  }
  int sum = ans;
  k = s[a[i] + a[j]];
  while (ans > 0) {
    ans--;
    tt[i]++;
    i = j;
    j = k;
    k = s[a[i] + a[j]];
  }
  return sum;
}
int main() {
  scanf("%I64d", &n);
  for (i = 0; i < n; i++) {
    scanf("%I64d", &x);
    if (!s[x]) {
      s[x] = ++length;
      a[length] = x;
    }
    tt[s[x]]++;
  }
  for (i = 1; i <= length; i++) {
    for (j = 1; j <= length; j++)
      if (!t[i][j]) {
        if (i == j && tt[i] < 2)
          k = 0;
        else
          k = Long(i, j);
        if (k > Max) Max = k;
      }
  }
  printf("%d\n", Max);
  return 0;
}
