#include <bits/stdc++.h>
using namespace std;
const int N = 101;
int a[N];
int n;
int main() {
  int i, t;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  t = a[0];
  a[0] = a[n - 1];
  a[n - 1] = t;
  for (i = 0; i < n; i++) cout << a[i] << ' ';
  cout << endl;
  return 0;
}
