#include <stdio.h>
void sort(int begin, int end,int *a);
int main() {
int n;
int a[100001];
scanf("%d",&n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
sort(1, n,a);
for (int i = 1; i <= n; i++) {
printf("%d ", a[i]);
}
return 0;
}
void sort(int begin,int end,int* a) {
if (begin>=end) {
return;
}
int temp = a[begin];
int i = begin;
int j = end;
while (i != j) {
while (a[j] >= temp && i < j)j--;
//必须从从右开始,且最后赋值用i
while (a[i] <= temp && i < j) i++;
if (i < j) {
int t = a[i];
a[i] = a[j];
a[j] = t;
}
}
a[begin] = a[i];
a[i] = temp;
sort(begin,i-1 ,a);
sort(i + 1,end,a);
}