import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
while (scan.hasNext()) {
int num = Integer.parseInt(scan.nextLine());
String[] inputs = scan.nextLine().split(" ");
int[] origins = new int[num];
int i = 0;
for (String s : inputs) {
origins[i++] = Integer.parseInt(s);
}
heapSortTwo(origins, num);
for (int oi = num - 1; oi >= 0; oi--)
System.out.print(origins[oi] + " ");
System.out.println();
}
}
public static void heapSortTwo(int[] arr, int length) {
int[] copy = buildHeapInsert(arr, length);
for (int i = 0; i < length; i++) {
swap(copy, 0, length - 1 - i);
minHeapDown(copy, 0, length - 1 - i);
}
System.arraycopy(copy, 0, arr, 0, length);
}
/**
* 逐个插入建立最小堆
* @param arr
* @param length
*/
public static int[] buildHeapInsert(int[] arr, int length) {
int[] heapArr = new int[length];
int heapLength = 0;
for (int i = 0; i < length; i++) {
heapArr[i] = arr[i];
minHeapUp(heapArr, i, ++heapLength);
}
return heapArr;
}
/**
* 维持堆的性质 上溯
* @param arr
* @param mark
* @param length
*/
public static void minHeapUp(int[] arr, int mark, int length) {
int parent = (mark - 1) >> 1;
while (parent >= 0) {
if (arr[parent] > arr[mark]) {
swap(arr, parent, mark);
mark = parent;
parent = (mark - 1) >> 1;
} else {
break;
}
}
}
public static void heapSortOne(int[] arr, int length) {
buildHeapInPlace(arr, length);
for (int i = 0; i < length; i++) {
swap(arr, 0, length - 1 - i);
minHeapDown(arr, 0, length - 1 - i);
}
}
/**
* 就地改变数组,建立堆
* @param arr
* @param length
*/
public static void buildHeapInPlace(int[] arr, int length) {
for (int i = (length - 1 - 1) >>> 1; i >= 0; i--)
minHeapDown(arr, i, length);
}
/**
* 维持堆的性质 下溯
* @param arr
* @param mark
* @param length
*/
public static void minHeapDown(int[] arr, int mark, int length) {
int left = (mark << 1) + 1;
int right = (mark << 1) + 2;
while (left < length) {
int min = left;
if (right < length && arr[right] < arr[left])
min = right;
if (arr[min] < arr[mark]) {
swap(arr, min, mark);
mark = min;
left = (mark << 1) + 1;
right = (mark << 1) + 2;
} else {
break;
}
}
}
public static void swap(int[] arr, int one, int two) {
int temp = arr[one];
arr[one] = arr[two];
arr[two] = temp;
}
}