#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, k = 0;
  int a[1005];
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  cout << a[n] << " ";
  for (i = 2; i < n; i++) cout << a[i] << " ";
  cout << a[1] << endl;
  return 0;
}
