#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
int main() {
  ll N;
  cin >> N;
  vector<ll> a(N);
  for (ll i = 0; i < N; i++) {
    cin >> a[i];
  }
  vector<ll> fi;
  vector<ll> la;
  for (ll i = 0; i < N; i++) {
    ll ma = 0;
    ll te;
    for (ll k = 0; k < N - i; k++) {
      if (a[k] > ma) {
        ma = a[k];
        te = k;
      }
    }
    if (te < ((N - i) / 2)) {
      la.insert(la.begin(), ma);
      a.erase(a.begin() + te);
    } else {
      fi.push_back(ma);
      a.erase(a.begin() + te);
    }
  }
  fi.insert(fi.end(), la.begin(), la.end());
  for (ll i = 0; i < N; i++) {
    cout << fi[i] << " ";
  }
  cout << endl;
  return 0;
}
