#include <bits/stdc++.h>
using namespace std;
bool qf = false;
int n, i, j, a[2016], first, second, third, temp, ans = 2, cnt;
map<int, int> f;
map<int, int>::iterator it;
vector<int> v;
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a[i]), f[a[i]]++;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (i == j) continue;
      ;
      if (a[i] == 0 and a[j] == 0) {
        ans = max(ans, f[0]);
        continue;
        ;
      }
      first = a[i];
      second = a[j];
      third = a[i] + a[j];
      f[first]--;
      f[second]--;
      cnt = 2;
      v.clear();
      v.push_back(first);
      v.push_back(second);
      while (1) {
        if (f.find(third) != f.end() and f[third] != 0) {
          cnt++;
          ans = max(ans, cnt);
          f[third]--;
          v.push_back(third);
          first = second;
          temp = second;
          second = third;
          third = temp + third;
        } else
          break;
      }
      for (int i = 0; i < v.size(); i++) f[v[i]]++;
    }
  }
  printf("%d", ans);
  return 0;
}
