#include <bits/stdc++.h>
using namespace std;
int arr[1111];
unordered_map<int, int> mp;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    ++mp[arr[i]];
  }
  set<pair<int, int> > st;
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == j) continue;
      pair<int, int> p = make_pair(arr[i], arr[j]);
      int v = 2;
      if (st.count(p) == 0) {
        st.insert(p);
        long long a = arr[i];
        long long b = arr[j];
        --mp[arr[i]];
        --mp[arr[j]];
        vector<int> vt;
        while (v < n) {
          long long t = a + b;
          if (mp[t] == 0) break;
          vt.push_back(t);
          --mp[t];
          ++v;
          a = b;
          b = t;
        }
        for (int i = 0; i < vt.size(); ++i) ++mp[vt[i]];
        ++mp[arr[i]];
        ++mp[arr[j]];
      }
      ans = max(ans, v);
    }
  }
  cout << ans << endl;
  return 0;
}
