#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int a[maxn];
int n;
int up(int n) {
int i = n;
while (i != 1 && a[i] < a[i / 2]) {
swap(a[i], a[i / 2]);
i = i / 2;
}
}
void down(int n, int i) {
while (i*2 <= n) {
i=i*2;
if (i + 1 <= n && a[i] > a[i + 1]) {
i++;
}
if (a[i] <= a[i / 2]) {
swap(a[i], a[i / 2]);
} else break;
}
}
void del() {
a[1] = a[n];
n--;
down(n, 1);
}
void heapsort() {
for (int i = n / 2; i >= 1; i--) {
down(n, i);
}
for (int i = n; i >= 1; i--) {
swap(a[i], a[1]);
down(i - 1, 1);
}
}
void add(int x) {
n++;
a[n] = x;
up(n);
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
heapsort();
for (int i = n; i >= 1; i--) {
printf("%d", a[i]);
if (i == 1) printf("
"); else printf(" ");
}
}