#include <bits/stdc++.h>
using namespace std;
long long a[1005];
long long b[1005];
int main() {
  int n;
  while (cin >> n) {
    unordered_map<long long, int> cnt;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      cnt[a[i]]++;
    }
    int ans = 0;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) {
        if (i == j) continue;
        if (a[i] == 0 && a[j] == 0) {
          ans = max(ans, cnt[0]);
          continue;
        }
        cnt[a[i]]--;
        cnt[a[j]]--;
        b[0] = a[i], b[1] = a[j];
        for (int k = 2;; ++k) {
          b[k] = b[k - 1] + b[k - 2];
          if (cnt[b[k]] > 0) {
            cnt[b[k]]--;
          } else {
            ans = max(ans, k);
            for (int l = 0; l < k; ++l) cnt[b[l]]++;
            break;
          }
        }
      }
    printf("%d\n", ans);
  }
}
