#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e3 + 7;
const int INF = 1e9;
int n, m, k, p, q, a, b, c, d, cnt = 0, ans = 0;
map<int, int> mp;
int ar[MAX];
vector<int> used;
set<pair<int, int> > did;
int solve(int a, int b) {
  if (did.find({a, b}) != did.end()) return 0;
  int ret = 2;
  used.push_back(a);
  used.push_back(b);
  mp[a]--;
  mp[b]--;
  while (true) {
    int tmp = a + b;
    if (tmp > 1e9) break;
    if (mp.find(tmp) == mp.end() || mp[tmp] <= 0) break;
    mp[tmp]--;
    used.push_back(tmp);
    a = b;
    b = tmp;
    ret++;
  }
  for (int i = 0; i < used.size(); ++i) mp[used[i]]++;
  used.clear();
  return ret;
}
int MAIN() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> ar[i];
    mp[ar[i]]++;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (i != j) {
        ans = max(ans, solve(ar[i], ar[j]));
        did.insert({ar[i], ar[j]});
      }
  cout << ans << endl;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  int start = clock();
  cout << fixed << setprecision(16);
  int ret = MAIN();
  return ret;
}
