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