#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#define FIN "algsort.in"
#define FOUT "algsort.out"
using namespace std;
vector<int> vec;
void _swap(int i, int j) {
int aux = vec[ i ];
vec[ i ] = vec[ j ];
vec[ j ] = aux;
}
void quicksort(int lo, int hi) {
int pivot = vec[ (lo + hi) >> 1],
i = lo,
j = hi;
while(i <= j) {
while(vec[i] < pivot) i++;
while(vec[j] > pivot) j--;
if(i<=j) {_swap(i, j); i++; j--;}
}
if(lo < j) quicksort(lo, j);
if(i < hi) quicksort(i, hi);
}
int main(int argc, char const *argv[]) {
int N,
num;
cin>>N;
for(int i = 0; i < N; i++) {
cin>>num;
vec.push_back(num);
}
quicksort(0, N - 1);
for(vector<int>::iterator it = vec.begin(); it != vec.end(); it++) {
cout<<(*it)<<" ";
}
return(0);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8ZnN0cmVhbT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGNzdHJpbmc+CiNkZWZpbmUgRklOICJhbGdzb3J0LmluIgojZGVmaW5lIEZPVVQgImFsZ3NvcnQub3V0IgoKdXNpbmcgIG5hbWVzcGFjZSBzdGQ7Cgp2ZWN0b3I8aW50PiB2ZWM7Cgp2b2lkIF9zd2FwKGludCBpLCBpbnQgaikgewoKICAgICBpbnQgYXV4ID0gdmVjWyBpIF07CiAgICAgICAgIHZlY1sgaSBdID0gdmVjWyBqIF07CiAgICAgICAgIHZlY1sgaiBdID0gYXV4Owp9Cgp2b2lkIHF1aWNrc29ydChpbnQgbG8sIGludCBoaSkgewoKICAgICBpbnQgcGl2b3QgPSB2ZWNbIChsbyArIGhpKSA+PiAxXSwKICAgICAgICAgIGkgPSBsbywKICAgICAgICAgIGogPSBoaTsKCiAgICAgICAgICB3aGlsZShpIDw9IGopIHsKICAgICAgICAgICAgICAgICB3aGlsZSh2ZWNbaV0gPCBwaXZvdCkgaSsrOwogICAgICAgICAgICAgICAgIHdoaWxlKHZlY1tqXSA+IHBpdm90KSBqLS07CiAgICAgICAgICAgICAgICAgaWYoaTw9aikge19zd2FwKGksIGopOyBpKys7IGotLTt9CiAgICAgICAgICB9CgogICAgICAgICAgaWYobG8gPCBqKSBxdWlja3NvcnQobG8sIGopOwogICAgICAgICAgaWYoaSA8IGhpKSBxdWlja3NvcnQoaSwgaGkpOwoKfQoKaW50IG1haW4oaW50IGFyZ2MsIGNoYXIgY29uc3QgKmFyZ3ZbXSkgewoKICBpbnQgTiwKICAgICAgIG51bTsKCiAgY2luPj5OOwogIGZvcihpbnQgaSA9IDA7IGkgPCBOOyBpKyspIHsKCiAgICAgIGNpbj4+bnVtOwogICAgICB2ZWMucHVzaF9iYWNrKG51bSk7CiAgfQoKICBxdWlja3NvcnQoMCwgTiAtIDEpOwoKICBmb3IodmVjdG9yPGludD46Oml0ZXJhdG9yIGl0ID0gdmVjLmJlZ2luKCk7IGl0ICE9IHZlYy5lbmQoKTsgaXQrKykgewoKICAgICAgY291dDw8KCppdCk8PCIgIjsKICB9CgogIHJldHVybigwKTsKfQo=