#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int a[1000];
int partition(int * a, int low, int high) {
int pivotKey;
pivotKey = a[low]; //将枢轴记录取出来,此位置就空出来了
while (low < high) {
while (low < high && a[high] >= pivotKey)
high--;
if (low < high)
a[low++] = a[high];
while (low < high && a[low] <= pivotKey)
low++;
if (low < high)
a[high--] = a[low];
}
a[low] = pivotKey;
return low;
}
void quickSort(int * a, int s, int t) {
int pivotLoc;
if (s < t) { //若长度为1,则不需要排序了
pivotLoc = partition(a, s, t);
quickSort(a, s, pivotLoc - 1);
quickSort(a, pivotLoc + 1, t);
}
}
void main() {
int n, i;
while (scanf("%d", &n) == 1) {
for (i = 0; i < n; i++)
scanf("%d", &a[i]);
quickSort(a, 0, n-1);
for (i = 0; i < n-1; i++)
printf("%d ", a[i]);
printf("%d\n", a[i]);
}
}