#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> v;
  for (long long int x = 0; x < n; x++) {
    long long int r;
    cin >> r;
    v.push_back(r);
  }
  sort(v.begin(), v.end());
  long long int t = v[0];
  v[0] = v[n - 1];
  v[n - 1] = t;
  for (long long int x = 0; x < n - 1; x++) {
    cout << v[x] << " ";
  }
  cout << v[n - 1];
  return 0;
}
