#include <bits/stdc++.h>
using namespace std;
long long modexp(long long base, long long exp) {
  if (exp == 1)
    return base;
  else if (exp == 0)
    return 1;
  else {
    if (exp % 2 == 0) {
      long long base1 = pow(modexp(base, exp / 2), 2);
      if (base1 >= 1000000007)
        return base1 % 1000000007;
      else
        return base1;
    } else {
      long long ans = (base * pow(modexp(base, (exp - 1) / 2), 2));
      if (ans >= 1000000007)
        return ans % 1000000007;
      else
        return ans;
    }
  }
}
long long a[1005], seq[1005], ans;
map<long long, long long> f;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    f[a[i]]++;
  }
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < n; ++j) {
      if (i != j) {
        if (!a[i] && !a[j]) continue;
        long long cur = 0, l = 2;
        f[a[i]]--, f[a[j]]--;
        seq[cur] = a[i], cur++;
        seq[cur] = a[j], cur++;
        while (1) {
          if (f[seq[cur - 1] + seq[cur - 2]]) {
            f[seq[cur - 1] + seq[cur - 2]]--;
            seq[cur] = seq[cur - 1] + seq[cur - 2];
            cur++;
            l++;
          } else
            break;
        }
        for (long long k = 0; k < cur; ++k) f[seq[k]]++;
        ans = max(l, ans);
      }
    }
  }
  cout << max(ans, f[0]);
  return 0;
}
