#include <bits/stdc++.h>
using namespace std;
const int N = 1e+5 + 111;
inline void Kazakhstan() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
long long a[1005];
map<long long, int> cnt;
int main() {
  Kazakhstan();
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      long long first = a[i], second = a[j];
      if (a[i] == 0 && a[j] == 0) {
        mx = max(cnt[0], mx);
        continue;
      }
      cnt[first]--;
      cnt[second]--;
      int len = 2;
      vector<int> v;
      v.push_back(first);
      v.push_back(second);
      for (;;) {
        int z = first + second;
        if (cnt[z] == 0) break;
        v.push_back(z);
        cnt[z]--;
        first = second, second = z;
        len++;
      }
      mx = max(mx, len);
      for (int i = 0; i < v.size(); i++) cnt[v[i]]++;
    }
  }
  cout << mx;
}
