#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[110], k = 0, l = 1, m = 0;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) {
      if (a[i] - a[j] > m) {
        m = a[i] - a[j];
        k = j;
        l = i;
      }
    }
  cout << a[l] << " ";
  for (int i = 0; i < n; i++)
    if (i != k && i != l) cout << a[i] << " ";
  cout << a[k];
  return 0;
}
