#include <bits/stdc++.h>
using namespace std;
int doit(vector<int> a, int i, int j) {
  int ch = 1, l = 2, y = j, sum = i + j, k;
  k = 0;
  while (a[k] != i) k++;
  a.erase(a.begin() + k);
  k = 0;
  while (a[k] != j) k++;
  a.erase(a.begin() + k);
  while (ch) {
    ch = 0;
    for (k = 0; k < a.size(); k++) {
      if (sum == a[k]) {
        sum = a[k] + y;
        y = a[k];
        a.erase(a.begin() + k);
        ch = 1;
        l++;
        break;
      }
    }
  }
  return l;
}
int main(int argc, char** argv) {
  int n, i, j, k, l = 2, temp;
  scanf("%d", &n);
  vector<int> a, b;
  for (i = 0; i < n; i++) {
    scanf("%d", &k);
    a.push_back(k);
    b.push_back(k);
  }
  for (i = 0; i < b.size(); i++) {
    for (j = i + 1; j < b.size(); j++) {
      if (b[i] > b[j]) {
        temp = b[i];
        b[i] = b[j];
        b[j] = temp;
      }
    }
  }
  for (i = 0; i + 2 < b.size(); i++) {
    if (b[i] == b[i + 1] && b[i + 1] == b[i + 2]) {
      b.erase(b.begin() + i + 2);
      i--;
    }
  }
  for (i = 0; i < b.size(); i++) {
    for (j = i + 1; j < b.size(); j++) {
      if (b[i] != b[j]) {
        k = doit(a, b[i], b[j]);
        l = l < k ? k : l;
        k = doit(a, b[j], b[i]);
        l = l < k ? k : l;
      } else {
        k = doit(a, b[j], b[i]);
        l = l < k ? k : l;
      }
    }
  }
  printf("%d", l);
  return 0;
}
