#include <bits/stdc++.h>
using namespace std;
long long choose(int n, int r) {
  if (n < r) {
    return 0;
  }
  if (n == r || r == 0) {
    return 1;
  }
  return choose(n - 1, r - 1) + choose(n - 1, r);
}
long long fact(int n) {
  if (n == 0 || n == 1) {
    return 1;
  }
  return n * fact(n - 1);
}
int get_factors(int n) {
  int numFactors = 0;
  for (int i = 1; i <= sqrt(n); i++) {
    bool divisible = n % i == 0;
    if (!divisible) {
      continue;
    }
    int quotient = n / i;
    numFactors++;
    if (quotient != i) {
      numFactors++;
    }
  }
  return numFactors;
}
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  iter_swap(v.begin(), v.end() - 1);
  for (int i : v) {
    cout << i << " ";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t-- > 0) {
    solve();
    cout << "\n";
  }
}
