K representatives on a line

For each K from 1 to N, place K real points on a line to minimize the total distance to all given points.

Hard8Dynamic programmingDivide and conquerGreedySortingNo attempts yetTime limit2sMemory limit512 MB

Problem

You are given a sequence of integers a1,a2,,aNa_1, a_2, \dots, a_N. For a positive integer KK, choose real numbers b1,b2,,bKb_1, b_2, \dots, b_K, which do not have to be integers, so that the value of SS is as small as possible.

S=i=1Nmin1jKaibjS=\sum_{i=1}^{N} \min_{1 \le j \le K} |a_i - b_j|

For every KK from 11 to NN, find the smallest possible value of SS.

Input

The first line contains a positive integer NN (1N50001 \le N \le 5000).

The second line contains the NN integers of the sequence aa, separated by spaces. Each value is between 00 and 200000200000. The sequence is not guaranteed to be sorted.

Output

Print NN numbers on one line, separated by spaces. The KK-th number is the smallest possible value of SS when the sequence bb has length KK. Every answer is an integer.

Hint

In the example you can take b={0,6,13}b = \{0, 6, 13\} for K=3K = 3, and b={0,5,9,13}b = \{0, 5, 9, 13\} for K=4K = 4.