#include <bits/stdc++.h>
using namespace std;
int cnt[1000000 + 1];
const int mod = 1e9 + 7;
vector<int> v;
void solve() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int mx = a[n - 1];
  deque<int> dq;
  int i = n - 1;
  for (i = n - 1; i >= 0; i--) {
    if (a[i] == mx) {
      dq.push_back(a[i]);
    } else
      break;
  }
  bool turn = true;
  for (i; i >= 0; i--) {
    if (turn == true) {
      dq.push_back(a[i]);
      turn = false;
    } else {
      dq.push_front(a[i]);
      turn = true;
    }
  }
  for (auto i : dq) cout << i << " ";
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  t = 1;
  while (t--) solve();
  return 0;
}
