#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> S;
int n;
int a[1010];
int f[2];
int ans;
vector<int> N;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    S[a[i]]++;
  }
  for (auto i : S) {
    N.push_back(i.first);
    if (i.second >= 2) N.push_back(i.first);
  }
  n = N.size();
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (i != j) {
        unordered_map<int, int> T;
        f[0] = N[i];
        f[1] = N[j];
        T[f[0]]++;
        int t = 1, tans = 1;
        while (S[f[t]] - T[f[t]]) {
          T[f[t]]++;
          tans++;
          t ^= 1;
          f[t] = f[t] + f[t ^ 1];
        }
        ans = max(ans, tans);
      }
  printf("%d", ans);
}
