#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int maxlog = 64;
const int mod = 1e9 + 7;
const int maxh = 2 * 350;
const int inf = 2e7 + 2;
map<int, int> m;
int a[maxn];
map<pair<int, int>, bool> tof;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(30);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      if (tof[make_pair(a[i], a[j])]) continue;
      tof[make_pair(a[i], a[j])] = true;
      vector<int> v;
      int x = a[i], y = a[j];
      m[x]--, m[y]--;
      v.push_back(x), v.push_back(y);
      while (true) {
        if (!m[x + y]) break;
        m[x + y]--;
        v.push_back(x + y);
        int x2 = x;
        x = y;
        y = x2 + y;
      }
      for (int k = 0; k < v.size(); k++) m[v[k]]++;
      ans = max(ans, (int)v.size());
    }
  }
  cout << ans;
  return 0;
}
