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;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long exp(long long x, long long y) {
  x %= 1000000007;
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
    y >>= 1;
  }
  return res;
}
long long fact(long long n) {
  long long res = 1;
  for (long long i = 2; i <= n; i = i + 1) (res *= i) %= 1000000007;
  return res;
}
bool isprime(long long n) {
  if (n <= 1) return 0;
  for (long long i = 2; i * i <= n; ++i)
    if (n % i == 0) return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> v(n), b, cnt(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  b = v;
  sort(b.begin(), b.end());
  int ans = 0;
  b.resize(unique(b.begin(), b.end()) - b.begin());
  for (int i = 0; i < n; ++i) {
    ans += (!v[i]);
    v[i] = lower_bound(b.begin(), b.end(), v[i]) - b.begin();
    ++cnt[v[i]];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == j || (!b[v[i]] && !b[v[j]])) continue;
      int pr = v[i], nw = v[j], mx = 2;
      --cnt[v[i]];
      --cnt[v[j]];
      vector<int> tmp{pr, nw};
      for (int idx = lower_bound(b.begin(), b.end(), b[pr] + b[nw]) - b.begin();
           idx < int(b.size()) && b[idx] == b[pr] + b[nw] && cnt[idx] > 0;
           idx = lower_bound(b.begin(), b.end(), b[pr] + b[nw]) - b.begin()) {
        --cnt[idx];
        ++mx;
        tmp.push_back(idx);
        pr = nw;
        nw = idx;
      }
      ans = max(ans, mx);
      for (auto c : tmp) {
        ++cnt[c];
      }
    }
  }
  cout << ans;
  return 0;
}
