using namespace std;
void depart(int array[],int start,int last);
void sort(int array[],int start,int center,int last);
void view(int array[],int length);
int main(int argc,char** argv){
int length;
cin >> length;
int data[length];
for(int i = 0;i < length;i++){
cin >> data[i];
}
depart(data,0,length - 1);
view(data,length);
return 0;
}
void depart(int array[],int start,int last){
if(last > start){
int center = (last - start) / 2 + start;
depart(array,start,center);
depart(array,center + 1,last);
sort(array,start,center,last);
}
}
void sort(int array[],int start,int center,int last){
int length1 = center - start + 1;
int length2 = last - center;
int array1[length1 + 1];
int array2[length2 + 1];
array1[length1] = 10000;
array2[length2] = 10000;
for(int i = 0;i < length1;i++){
array1[i] = array[i + start];
}
for(int i = 0;i < length2;i++){
array2[i] = array[i + center + 1];
}
int m = 0,n = 0;
for(int i = start;i <= last;i++){
if(array1[m] < array2[n]){
array[i] = array1[m];
m++;
}else{
array[i] = array2[n];
n++;
}
}
}
void view(int array[],int length){
for(int i = 0;i < length;i++){
cout << array[i] << " ";
}
cout << endl << endl;
}