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.
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class x633D
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int[] arr = new int[N];
         st = new StringTokenizer(infile.readLine());
         for(int i=0; i < N; i++)
            arr[i] = Integer.parseInt(st.nextToken());
         HashMap<Integer, Integer> mset = new HashMap<Integer, Integer>();
         for(int x: arr)
            push(mset, x);
         int res = Math.max(2, zc(arr));
         ArrayList<Integer> ls = distinct(arr);
         Collections.sort(ls);
         for(int a=0; a < ls.size(); a++)
            for(int b=0; b < ls.size(); b++)
               if(a != b || a == b && mset.get(ls.get(a)) >= 2)
               {
                  LinkedList<Integer> moves = new LinkedList<Integer>();
                  moves.add(ls.get(a)); moves.add(ls.get(b));
                  pull(mset, ls.get(a));  pull(mset, ls.get(b));
                  int x = ls.get(a);
                  int y = ls.get(b);
                  int temp = 2;
                  while(mset.containsKey(x+y))
                  {
                     int next = x+y;
                     moves.add(next);
                     pull(mset, next);
                     x = y;
                     y = next;
                     temp++;
                  }
                  res = Math.max(res, temp);
                  for(int v: moves)
                     push(mset, v);
               }
         System.out.println(res);
      }
      public static ArrayList<Integer> distinct(int[] arr)
      {
         ArrayList<Integer> ls = new ArrayList<Integer>();
         HashSet<Integer> set = new HashSet<Integer>();
         for(int x: arr)
            if(set.add(x))
               ls.add(x);
         return ls;
      }
      public static int zc(int[] arr)
      {
         int x = 0;
         for(int xx: arr)
            if(xx == 0)
               x++;
         return x;
      }
      public static void push(HashMap<Integer, Integer> map, int k)
      {
         if(!map.containsKey(k))
            map.put(k, 0);
         map.put(k, map.get(k)+1);
      }
      public static void pull(HashMap<Integer, Integer> map, int k)
      {
         map.put(k, map.get(k)-1);
         if(map.get(k) == 0)
            map.remove(k);
      }
   }