#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 5;
long long n;
long long a[N];
long long ans = 0;
map<long long, long long> mp;
map<pair<int, int>, bool> cmp;
bool mark[N][N];
long long check(long long k, long long t) {
  if (a[k] == 0 && a[t] == 0) {
    return mp[0];
  }
  long long ans = 2;
  map<long long, long long> cp;
  map<long long, bool> used;
  cp[a[k]] = mp[a[k]];
  cp[a[t]] = mp[a[t]];
  used[a[k]] = true;
  used[a[t]] = true;
  cp[a[k]]--;
  cp[a[t]]--;
  long long f1 = a[k];
  long long f2 = a[t];
  while (true) {
    long long tmp = f1 + f2;
    f1 = f2;
    f2 = tmp;
    if (!used[tmp]) {
      cp[tmp] = mp[tmp];
      used[tmp] = true;
    }
    cp[tmp]--;
    if (cp[tmp] < 0) {
      break;
    }
    ans++;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (i == j) {
        continue;
      }
      if (!cmp[{a[i], a[j]}]) {
        ans = max(ans, check(i, j));
        cmp[{a[i], a[j]}] = true;
      }
    }
  }
  cout << ans << endl;
}
