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;
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;
}
