Problems
Max-heap
Max-heap
Given array of integers. Rearrange its elements so that to get a \textbf{max-heap}.
\InputFile
First line contains number of elements $n~(n \le 1000)$. Second line contains $n$ integers, no more than $10^6$ by absolute value.
\OutputFile
Print array that corresponds to max-heap.
\includegraphics{https://static.e-olymp.com/content/94/94b59391780652167dd211f1a56ef2f14d2f7ffd.gif}
Input example #1
6 5 3 2 7 1 10
Output example #1
10 7 5 3 1 2