- Time limit: 1.00 s
- Memory limit: 512 MB
Given an array of integers, consider pairings of pairs. Each number can appear in at most one pair, and the cost of a pair is . The cost of a pairing is the sum of all costs of the pairs.
Calculate the minimum costs of pairings for .
Input
The first line has an integer: the array size.
The next line has integers : the array contents.
Output
Print integers: the minimum costs of pairings.
Constraints
Example
Input:
8 3 1 2 7 9 3 4 7
Output:
0 0 1 6
Explanation: Possible minimum-cost pairings are , , and .