CSES - Minimum Cost Pairs
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Given an array of nn integers, consider pairings of kk pairs. Each number can appear in at most one pair, and the cost of a pair (a,b)(a,b) is ab|a-b|. The cost of a pairing is the sum of all costs of the pairs.

Calculate the minimum costs of pairings for k=1,2,,n/2k=1,2,\dots,\lfloor n/2 \rfloor.

Input

The first line has an integer: the array size.

The next line has nn integers x1,x2,,xnx_1,x_2,\dots,x_n: the array contents.

Output

Print n/2\lfloor n/2 \rfloor integers: the minimum costs of pairings.

Constraints

  • 2n21052 \le n \le 2 \cdot 10^5
  • 1xi1091 \le x_i \le 10^9

Example

Input:

8
3 1 2 7 9 3 4 7

Output:

0 0 1 6

Explanation: Possible minimum-cost pairings are [(3,3)][(3,3)], [(3,3),(7,7)][(3,3),(7,7)], [(1,2),(3,3),(7,7)][(1,2),(3,3),(7,7)] and [(1,2),(3,3),(4,7),(7,9)][(1,2),(3,3),(4,7),(7,9)].