#include <bits/stdc++.h>
using namespace std;
short int dp[4100][4100 * 2];
int d[4100];
int main() {
  vector<int> tmp;
  int n;
  scanf(" %d", &n);
  for (int i = 0; i < n; i++) {
    scanf(" %d", &d[i]);
    tmp.push_back(d[i]);
  }
  sort(tmp.begin(), tmp.end());
  int ec = unique(tmp.begin(), tmp.end()) - tmp.begin();
  for (int i = 0; i < n; i++) {
    d[i] = lower_bound(tmp.begin(), tmp.begin() + ec, d[i]) - tmp.begin();
  }
  memset(dp, 0, sizeof(dp));
  int ans = 1;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < i; j++) {
      int v = d[i] + d[j];
      dp[i][v] = max(dp[i][v] + 0, dp[j][v] + 1);
      ans = max(dp[i][v] + 1, ans);
    }
  }
  printf("%d\n", ans);
  return 0;
}
