The Longest Fence

Given up to 10^6 board lengths (each at most 2000), pair them into boards of equal sum and report the largest possible number of boards plus how many sums reach it.

Medium6ArrayTwo pointersImplementationMathNo attempts yetTime limit2sMemory limit512 MB

Problem

Tudor is a contestant in a carpentry competition. To win, he has to nail pieces of wood together and build the longest fence he can. Tudor has N pieces of wood, and the ith piece has integer length LiL_i.

A board is made of exactly two pieces of wood. A board built from pieces of length LiL_i and LjL_j has length Li+LjL_i + L_j. A fence consists of boards that all have the same length. The length of the fence is the number of boards in it, and the height of the fence is the length of one board. The fence drawn below has length 4 and height 50, with the length of every piece of wood written on it.

Each piece of wood goes into at most one board, and leftover pieces are allowed. Find the maximum length of a fence Tudor can build, and how many different heights a fence of that maximum length can have.

Input

The first line contains the integer N (2N1062 \le N \le 10^6).

The second line contains the integers L1,L2,,LNL_1, L_2, \dots, L_N separated by single spaces (1Li20001 \le L_i \le 2000).

Output

Print two integers on one line, separated by a single space: the maximum length of a fence, and the number of different heights a fence of that maximum length can have.

Hint

In the first example Tudor nails the pieces of length 1 and 4 into a board of length 5, then nails the pieces of length 2 and 3 into a second board of length 5. The two boards form a fence of length 2 and height 5.

In the second example no fence longer than 1 exists. There are 10 ways to pick two pieces and every sum is different, so a fence of length 1 has one of 10 heights: 11, 101, 1001, 2001, 110, 1010, 2010, 1100, 2100, 3000.