Max-heap#10166

Max-heap

1 second
128 megabytes
Easy

Given an array of integers. Rearrange its elements to form a max-heap.

Input

The first line contains the number of elements in the array n~(n \le 1000).

The second line contains integers, each with an absolute value not exceeding 10^6.

Output

Print the rearranged array representing a max-heap. If there are multiple solutions, print any one of them.

Examples

Example 1

Loading
Loading