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.
import java.util.*;
import java.io.*;

public class CFA {
  BufferedReader br;
  PrintWriter out;
  StringTokenizer st;
  boolean eof;
  private static final long MOD = 1000L * 1000L * 1000L + 7;
  private static final int[] dx = {0, -1, 0, 1};
  private static final int[] dy = {1, 0, -1, 0};
  private static final String yes = "Yes";
  private static final String no = "No";

  void solve() {
//    int T = nextInt();
    int T = 1;
    for (int i = 0; i < T; i++) {
        helper();
    }
  }

  Map<Long, Integer> hm = new HashMap<>();
  void helper() {
    int n = nextInt();
    int[] arr = nextIntArr(n);
    for (int v : arr) {
      add(v);
    }
    shuffle(arr);
    Arrays.sort(arr);
    int res = hm.getOrDefault(0L, 0);

    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (arr[i] == 0 && arr[j] == 0) {
          continue;
        }
        res = Math.max(res, check(arr[i], arr[j]));
        res = Math.max(res, check(arr[j], arr[i]));

        while (j + 1 < n && arr[j + 1] == arr[j]) {
          j++;
        }
      }

      while (i + 1 < n && arr[i + 1] == arr[i]) {
        i++;
      }
    }
    outln(res);
  }

  int check(long v1, long v2) {
    long v11 = v1;
    long v22 = v2;
    remove(v1);
    remove(v2);
    List<Long> extra = new ArrayList<>();
    while (hm.containsKey(v1 + v2)) {
      long nxt = v1 + v2;
      v1 = v2;
      v2 = nxt;
      extra.add(nxt);
      remove(nxt);
    }

    int res = 2 + extra.size();
    for (long v : extra) {
      add(v);
    }
    add(v11);
    add(v22);
    return res;
  }

  void remove(long v) {
    if (hm.getOrDefault(v, 0) == 0) {
      return;
    } else if (hm.get(v) == 1) {
      hm.remove(v);
      return;
    }

    hm.put(v, hm.get(v) - 1);
  }

  void add(long v) {
    hm.put(v, hm.getOrDefault(v, 0) + 1);
  }

  void shuffle(int[] a) {
    int n = a.length;
    for(int i = 0; i < n; i++) {
        int r = i + (int) (Math.random() * (n - i));
        int tmp = a[i];
        a[i] = a[r];
        a[r] = tmp;
    }
  }
  int gcd(int a, int b) {
    while(a != 0 && b != 0) {
        int c = b;
        b = a % b;
        a = c;
    }
    return a + b;
  }
  private void outln(Object o) {
      out.println(o);
  }
  private void out(Object o) {
      out.print(o);
  }
  private void formatPrint(double val) {
      outln(String.format("%.9f%n", val));
  }
  public CFA() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);
    solve();
    out.close();
  }
  public static void main(String[] args) {
      new CFA();
  }

  public long[] nextLongArr(int n) {
    long[] res = new long[n];
    for(int i = 0; i < n; i++)
        res[i] = nextLong();
    return res;
  }
  public int[] nextIntArr(int n) {
    int[] res = new int[n];
    for(int i = 0; i < n; i++)
        res[i] = nextInt();
    return res;
  }
  public String nextToken() {
    while (st == null || !st.hasMoreTokens()) {
        try {
            st = new StringTokenizer(br.readLine());
        } catch (Exception e) {
            eof = true;
            return null;
        }
    }
    return st.nextToken();
  }
  public String nextString() {
    try {
        return br.readLine();
    } catch (IOException e) {
        eof = true;
        return null;
    }
  }
  public int nextInt() {
      return Integer.parseInt(nextToken());
  }
  public long nextLong() {
      return Long.parseLong(nextToken());
  }
  public double nextDouble() {
        return Double.parseDouble(nextToken());
    }
}
