#include <bits/stdc++.h>
const int MAX = 1000000000;
int64_t a[1000];
std::unordered_map<int, int> cnt;
int64_t F[400];
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  std::cin >> n;
  cnt.reserve(n);
  cnt.max_load_factor(0.25);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
    cnt[a[i]]++;
  }
  int ans = std::max(2, cnt[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) continue;
      F[0] = a[i];
      cnt[a[i]]--;
      F[1] = a[j];
      cnt[a[j]]--;
      int len = 2;
      while (std::abs(F[len - 1] + F[len - 2]) <= MAX) {
        F[len] = F[len - 1] + F[len - 2];
        if (cnt[F[len]] > 0) {
          cnt[F[len]]--;
          len++;
        } else {
          break;
        }
      }
      for (int k = 0; k < len; ++k) {
        cnt[F[k]]++;
      }
      ans = std::max(ans, len);
    }
  }
  std::cout << ans << '\n';
  return 0;
}
