#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <vector>
#include <map>
using namespace std;
void lsqrt(int *a, int x, int y)
{
if (x > y)
return;
else
{
int k = a[x];
int i = x;
int j = y;
while (i != j)
{
while (a[j] >= k && i < j)
j--;
while (a[i] <= k && i < j)
{
i++;
}
if (j > i)
swap(a[i], a[j]);
}
swap(a[x], a[i]);
lsqrt(a, x, j - 1);//zuobian
lsqrt(a, i + 1, y);//youbian
}
}
int main()
{
int n;
int a[100] = { 0 };
int x, y;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
}
x = 1;
y = n;
lsqrt(a, x, y);
for (int i = 1; i <= n; i++)
{
cout << a[i] << " ";
}
return 0;
}