#include<iostream>
using namespace std;
//找到轴值得位置
int position(int *a, int start, int end){
int i = start, j = end;
while(i < j){
while(a[i] < a[j] && i < j)
j--;
swap(a[i] , a[j]);//交换位置
while(a[i] < a[j] && i < j)
i++;
swap(a[i], a[j]);//交换位置
}
return i;
}
void QuikSort(int *a, int start, int end){
if(start >= end) //递归结束出口
return;
else{
int p = position(a, start, end);
QuikSort(a, start, p-1);
QuikSort(a, p+1, end);
}
}
int main(){
int m;
cin >> m;
int *a = new int[m+1];
for(int i = 1; i <= m; i++){
cin >> a[i];
}
QuikSort(a, 1, m);
for(int i = 1; i <= m; i++){
cout << a[i] <<" ";
}
}