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>
const int INF = 0x7F7F7F7F;
const double EPS = 1e-10;
using namespace std;
inline long long rit() {
  long long f = 0, key = 1;
  char c;
  do {
    c = getchar();
    if (c == '-') key = -1;
  } while (c < '0' || c > '9');
  do {
    f = f * 10 + c - '0';
    c = getchar();
  } while (c >= '0' && c <= '9');
  return f * key;
}
void init() {}
const int Z = 1005;
int n;
int a[Z], chk[Z], cnt[Z], lst[Z];
vector<int> vv;
inline int fnd(int x) {
  return lower_bound(vv.begin(), vv.end(), x) - vv.begin();
}
void read() {
  int i;
  n = rit();
  for (i = 0; i < n; i++) {
    a[i] = rit();
    vv.push_back(a[i]);
  }
  sort(a, a + n);
  sort(vv.begin(), vv.end());
  vv.resize(unique(vv.begin(), vv.end()) - vv.begin());
  for (i = 0; i < n; i++) {
    chk[fnd(a[i])]++;
  }
}
set<pair<int, int> > mk;
void solve() {
  int i, j, now, fi, fj, str, ans, l, l2;
  ans = 2;
  for (now = 1, i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (i == j) continue;
      if (mk.find(make_pair(a[i], a[j])) != mk.end()) continue;
      mk.insert(make_pair(a[i], a[j]));
      fi = fnd(a[i] + a[j]);
      if (fi >= vv.size()) break;
      if (vv[fi] != a[i] + a[j]) continue;
      fi = fnd(a[i]), fj = fnd(a[j]);
      lst[fi] = lst[fj] = now;
      if (fi == fj)
        cnt[fi] = 2;
      else
        cnt[fi] = cnt[fj] = 1;
      str = 2;
      l = a[i];
      l2 = a[j];
      while (1) {
        fi = fnd(l + l2);
        if (fi >= vv.size() || vv[fi] != l + l2) break;
        if (lst[fi] != now) {
          fj = cnt[fi] = 0;
          lst[fi] = now;
        } else
          fj = cnt[fi];
        if (chk[fi] > fj) {
          cnt[fi]++;
          fi = l;
          l = l2;
          l2 = fi + l;
        } else
          break;
        str++;
      }
      ans = max(str, ans);
      now++;
    }
  }
  cout << ans << endl;
}
int main() {
  int nn = 1;
  init();
  while (nn--) {
    read();
    solve();
  }
  return 0;
}
