#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
map<pii, ll> memo;
set<ll> st;
map<ll, ll> cnts;
ll dp(ll a, ll b) {
  if (st.find(a + b) == st.end() || cnts[a + b] == 0) return 2;
  if (a == 0 && b == 0) return cnts[0];
  cnts[a + b]--;
  return 1 + dp(b, a + b);
  cnts[a + b]++;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  ll a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    ll x = a[i];
    st.insert(x);
    if (cnts.find(x) == cnts.end()) cnts[x] = 0;
    cnts[x]++;
  }
  ll out = 0;
  for (int diff = 1; diff < n; diff++) {
    for (int i = 0; i < n; i++) {
      cnts[a[i]]--;
      cnts[a[(i + diff) % n]]--;
      out = max(out, dp(a[i], a[(i + diff) % n]));
      cnts[a[i]]++;
      cnts[a[(i + diff) % n]]++;
    }
  }
  cout << out << endl;
}
