#include <cstdio>
#include <cstring>

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

enum { maxn = 5010, BN = 16, maxC = 1 << BN };

int n, a[maxn], b[maxn], cnt[maxC + 1];

int main()
{
  freopen("bubble.in", "r", stdin);
  freopen("bubble.out", "w", stdout);

  scanf("%d", &n);
  forn(i, n)
    scanf("%d", &a[i]);

  forn(t, 2)
  {
    #define GET(i) ((a[i] >> (t * BN)) & (maxC - 1))
    memset(cnt, 0, sizeof(cnt));
    forn(i, n)
      cnt[GET(i) + 1]++;
    forn(i, maxC - 1)
      cnt[i + 1] += cnt[i];
    forn(i, n)
      b[cnt[GET(i)]++] = a[i];
    forn(i, n)
      a[i] = b[i];
  }

  forn(i, n)
    printf("%d ", a[i]);
  return 0;
}