#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    v.push_back(d);
  }
  sort(v.begin(), v.end());
  int temp = v[0];
  v[0] = v[n - 1];
  v[n - 1] = temp;
  for (int i = 0; i < n; i++) cout << v[i] << " ";
  cout << endl;
  return 0;
}
