#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(1e9) + 100;
const int mod = (int)(1e9) + 7;
const int N = (int)(1e5) + 100;
int n, a[2 * N], ans = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  swap(a[0], a[n - 1]);
  for (int i = 0; i < n; i++) cout << a[i] << ' ';
  return 0;
}
