#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int m[n];
  multiset<int> kek;
  set<pair<int, int> > memkek;
  queue<int> mem;
  for (int i = 0; i < n; i++) {
    cin >> m[i];
    kek.insert(m[i]);
  }
  int ans = 0;
  int curr, next;
  int lst, plst;
  multiset<int>::iterator itr;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (memkek.find(make_pair(m[i], m[j])) != memkek.end()) continue;
      if (i == j) continue;
      curr = 2;
      plst = m[i];
      lst = m[j];
      kek.erase(kek.find(m[i]));
      kek.erase(kek.find(m[j]));
      mem.push(m[i]);
      mem.push(m[j]);
      for (; true; curr++) {
        next = plst + lst;
        itr = kek.find(next);
        if (itr == kek.end()) {
          break;
        }
        mem.push(next);
        kek.erase(itr);
        plst = lst;
        lst = next;
      }
      while (!mem.empty()) {
        kek.insert(mem.front());
        mem.pop();
      }
      ans = max(ans, curr);
      memkek.insert(make_pair(m[i], m[j]));
    }
  }
  cout << ans;
}
