#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000;
int f[MAXN];
unordered_multiset<int> is;
int gans = 0;
void gen(int f1, int f2) {
  vector<int> buf = {f1, f2};
  is.erase(is.find(f1));
  is.erase(is.find(f2));
  while (is.find(buf[((int)(buf.size())) - 1] + buf[((int)(buf.size())) - 2]) !=
         is.end()) {
    buf.push_back(buf[((int)(buf.size())) - 1] + buf[((int)(buf.size())) - 2]);
    is.erase(is.find(buf.back()));
  }
  gans = max(gans, ((int)(buf.size())));
  for (int i = 0; i < ((int)(buf.size())); i++) {
    is.insert(buf[i]);
  }
}
set<pair<int, int> > was;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> f[i];
    is.insert(f[i]);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (was.find(make_pair(f[i], f[j])) == was.end() && i != j) {
        was.insert(make_pair(f[i], f[j]));
        gen(f[i], f[j]);
      }
    }
  }
  cout << gans << endl;
  return 0;
}
