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;
template <typename T>
void r1(T &x) {
  x = 0;
  char c(getchar());
  int f(1);
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; '0' <= c && c <= '9'; c = getchar()) x = (x * 10) + (c ^ 48);
  x *= f;
}
const long long maxn = 2e5 + 5;
const long long maxm = maxn << 1;
long long n, m, a[maxn];
map<long long, long long> vis;
signed main() {
  long long i, j, ans;
  r1(n);
  for (i = 1; i <= n; ++i) r1(a[i]), vis[a[i]]++;
  sort(a + 1, a + n + 1), ans = max(vis[0], 0ll);
  for (i = 1; i <= n; ++i) {
    for (j = 1; j <= n; ++j)
      if (i != j) {
        if (a[i] == 0 && a[j] == 0) continue;
        if (i > 1 && a[i - 1] == a[i]) break;
        if (j > 1 && i + 1 != j && a[j - 1] == a[j]) continue;
        long long res(2), f0(a[i]), f1(a[j]), f2(a[i] + a[j]);
        map<long long, long long> vis1;
        ++vis1[f0], ++vis1[f1];
        while (vis1[f2] < vis[f2]) {
          ++vis1[f2], ++res;
          f0 = f1, f1 = f2, f2 = f1 + f0;
        }
        ans = max(ans, res);
      }
  }
  printf("%d\n", ans);
  return 0;
}
