#include <bits/stdc++.h>
using namespace std;
int v[1000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v, v + n);
  reverse(v, v + n);
  sort(v + 1, v + (n - 1));
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << v[i];
  }
  cout << endl;
}
