#include<bits/stdc++.h>
using namespace std;
int n;
int a[10006];
int sort(int low ,int high)
{
a[0] = a[low];
int tag=a[low];
while(low<high)
{
while(low < high && a[high] >= tag) high--;
a[low] = a[high];
while(low < high && a[low] <= tag) low++;
a[high] = a[low];
}
a[low] = a[0];
return low;
}
void find(int l, int r)
{
if(l<r){
int tmp = sort(l,r);
find(l,tmp-1);
find(tmp+1,r);
}
}
int main()
{
cin >> n;
for(int i=1;i<=n;i++)
cin >> a[i];
find(1,n);
for(int i=1;i<=n;i++)
cout << a[i] <<" ";
}