#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[200];
  cin >> n;
  int indmax = 0, indmin = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < a[indmin]) indmin = i;
    if (a[i] > a[indmax]) indmax = i;
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      if (a[i] > a[j]) {
        int t = a[i];
        a[i] = a[j];
        a[j] = t;
      }
    }
  }
  int t = a[0];
  a[0] = a[n - 1];
  a[n - 1] = t;
  for (int i = 0; i < n; i++) {
    cout << a[i] << ' ';
  }
  return 0;
}
