#include <bits/stdc++.h>
using namespace std;
template <typename T>
T next_int() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') {
    p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return p * x;
}
string next_token() {
  char ch;
  string ans = "";
  do {
    ch = getchar();
  } while (ch <= ' ');
  while (ch > ' ') {
    ans += ch;
    ch = getchar();
  }
  return ans;
}
const long long INF = (long long)1e18;
const int INFINT = (int)1e9 + 227 + 1;
const int MAXN = (int)1e3 + 227 + 1;
const int MOD = (int)1e9 + 7;
const long double EPS = 1e-9;
long long bin_pow(long long a, long long b) {
  if (!b) return 1;
  long long ans = bin_pow(a, b / 2);
  ans = ans * ans % MOD;
  if (b % 2) ans = ans * a % MOD;
  return ans;
}
map<int, int> number, k;
map<pair<int, int>, bool> used;
int ans = 0;
inline void go(int a, int b, int t) {
  k[a]++;
  k[b]++;
  while (1) {
    if (k[a + b] < number[a + b]) {
      swap(a, b);
      b += a;
      k[b]++;
      t++;
    } else {
      ans = max(ans, t);
      return;
    }
  }
}
int main() {
  int n = next_int<int>();
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    a[i] = next_int<int>();
    number[a[i]]++;
  }
  ans = number[0];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if ((!a[i] && !a[j]) || i == j || used[make_pair(a[i], a[j])]) continue;
      k.clear();
      used[make_pair(a[i], a[j])] = 1;
      go(a[i], a[j], 2);
    }
  }
  cout << ans << "\n";
}
