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;
long long power(long long a, long long b, long long m = 1000000007) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long res = power(a, b / 2, m);
  res = (res * res) % m;
  if (b & 1) res = (res * a) % m;
  return res;
}
long long modinv(long long a, long long m = 1000000007) {
  return power(a, m - 2, m);
}
long long add(long long a, long long b, long long m = 1000000007) {
  long long c = (a % m + b % m);
  if (c >= m) c -= m;
  return c;
}
long long sub(long long a, long long b, long long m = 1000000007) {
  long long c = (a % m - b % m);
  if (c < 0) c += m;
  return c;
}
long long mul(long long a, long long b, long long m = 1000000007) {
  return (a * b) % m;
}
long long a[1001];
void solve() {
  long long n, i, j, ans = 0;
  cin >> n;
  map<long long, long long> mp;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (!a[i]) ans++;
    mp[a[i]]++;
  }
  sort(a, a + n);
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if ((!a[i] && !a[j]) || (i == j)) continue;
      vector<long long> v = {a[i], a[j]};
      mp[a[i]]--;
      mp[a[j]]--;
      long long x = 1;
      while (1) {
        long long y = v[x] + v[x - 1];
        if (mp.find(y) == mp.end() || mp[y] == 0) break;
        v.push_back(y);
        mp[y]--;
        x++;
      }
      ans = max(ans, (long long)v.size());
      for (auto x : v) mp[x]++;
    }
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
