#include void sort(int n, int* a) { if (n <= 2) return; for (int i = 1; i < 2 * n - 3; ++i) { for (int p = 0; p <= n - 1; ++p) { int q = i - p; if (a[p] > a[q] && q <= n - 1 && p < q) { int tmp = a[p]; a[p] = a[q]; a[q] = tmp; } } } } int main () { std::cin.tie(0); std::ios::sync_with_stdio(false); int n; std::cin >> n; int a[2000]; for(int i = 0; i < n; ++i) { std::cin >> a[i]; } sort(n, a); for(int i = 0; i < n; ++i) { if (i) std::cout << " "; std::cout << a[i]; } std::cout << std::endl; }