Yash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish if 

  1. the sequence consists of at least two elements 
  2. f0 and f1 are arbitrary 
  3. fn + 2 = fn + 1 + fn for all n ≥ 0. 



You are given some sequence of integers a1, a2, ..., an. Your task is rearrange elements of this sequence in such a way that its longest possible prefix is Fibonacci-ish sequence.

Input

The first line of the input contains a single integer n (2 ≤ n ≤ 1000) — the length of the sequence ai.

The second line contains n integers a1, a2, ..., an (|ai| ≤ 109).

Output

Print the length of the longest possible Fibonacci-ish prefix of the given sequence after rearrangement.

Examples

Input

3
1 2 -1


Output

3


Input

5
28 35 7 14 21


Output

4

Note

In the first sample, if we rearrange elements of the sequence as  - 1, 2, 1, the whole sequence ai would be Fibonacci-ish.

In the second sample, the optimal way to rearrange elements is <image>, <image>, <image>, <image>, 28.
#include <bits/stdc++.h>
using namespace std;
int N;
signed long long A[1010];
int num[1010][1010];
map<int, int> M;
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N;
  for (i = 0; i < (N); i++) cin >> A[i];
  A[N] = -1LL << 60;
  A[N + 1] = 1LL << 60;
  N += 2;
  sort(A, A + N);
  for (i = 0; i < (N - 2); i++) M[A[i + 1]]++;
  int ma = max(M[0], 2);
  for (x = 1; x < N - 1; x++)
    for (y = 1; y < N - 1; y++)
      if (x != y) {
        if (A[x] == 0 && A[y] == 0) continue;
        vector<signed long long> V;
        V.push_back(A[x]);
        V.push_back(A[y]);
        M[A[x]]--;
        M[A[y]]--;
        int cur = 2;
        signed long long a = A[x], b = A[y];
        int lp = 0;
        int ng = 0;
        while (1) {
          signed long long v = a + b;
          if (M.count(v) > 0 && M[v]) {
            cur++;
            V.push_back(v);
            M[v]--;
            a = b;
            b = v;
          } else {
            break;
          }
        }
        ma = max(ma, cur);
        for (auto& r : V) M[r]++;
      }
  cout << ma << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}
