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;
const long long MOD = 1000000007;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int ddx[] = {0, 0, 1, 1, 1, -1, -1, -1}, ddy[] = {1, -1, 1, 0, -1, 1, 0, -1};
int a[1000];
bool chk[1000];
int main() {
  int n;
  scanf("%d", &n);
  int ans = 0;
  for (int(i) = (0); (i) <= (n - 1); (i) += (1)) {
    scanf("%d", a + i);
    if (a[i] == 0) ans++;
  }
  ans = max(ans, 2);
  stack<int> st;
  sort(a, a + n);
  for (int(i) = (0); (i) <= (n - 1); (i) += (1))
    for (int(j) = (0); (j) <= (n - 1); (j) += (1)) {
      if (i == j || (a[i] == 0 && a[j] == 0)) continue;
      int f = a[i], s = a[j], t = 2;
      st.push(i);
      st.push(j);
      chk[i] = chk[j] = 1;
      while (1) {
        int l = 0, r = n - 1;
        while (l <= r) {
          int m = (l + r) >> 1;
          if (a[m] < f + s)
            l = m + 1;
          else if (a[m] > f + s)
            r = m - 1;
          else if (chk[m])
            l = m + 1;
          else
            r = m - 1;
        }
        if (l == n || a[l] != f + s) break;
        t++;
        chk[l] = 1;
        st.push(l);
        swap(f, s);
        s += f;
      }
      ans = max(ans, t);
      while (!st.empty()) {
        chk[st.top()] = 0;
        st.pop();
      }
    }
  printf("%d", ans);
}
