Given a max-heap with n numbers, all the elements are guaranteed to satisfy the max-heap property except the root. You are asked to fix the heap and make sure all the numbers in the heap actually satisfy the max-heap property.
Input
The first line of the input contains a single integer n (1 β€ n β€ 100 000).
The next line contains n space-separated integers () representing the values of the elements in the heap.
Output
The program should print n space-separated integers representing the fixed heap.