#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <vector>
#include <limits.h>
#include <string>
#include <map>
#include <math.h>
#include <list>
#include <stack>
#include <cmath>
using namespace std;
int Partition(vector<int>& nums, int length, int start, int e){
if(start < 0 || e >= length){
throw;
}
int mid = (start + e)/2;
swap(nums[mid], nums[e]);
int index = start-1;
for(int i = start; i < e; i++){
if(nums[i] < nums[e]){
index++;
if(index != i){
swap(nums[i], nums[index]);
}
}
}
index++;
swap(nums[index], nums[e]);
return index;
}
void helpsort(vector<int>& nums, int length, int start, int e){
if(start < e){
int index = Partition(nums, length, start, e);
helpsort(nums, length, start, index-1);
helpsort(nums, length, index+1, e);
}
return;
}
void quicksort(vector<int>& nums, int length){
if(length < 2){
return;
}
helpsort(nums, length, 0, length-1);
for(auto n:nums){
cout << n <<" ";
}
return;
}
int main()
{
int n;
cin >> n;
vector<int> nums(n);
for(int i = 0; i < n; i++){
cin >> nums[i];
}
quicksort(nums, n);
return 0;
}