#include <bits/stdc++.h>
using namespace std;
int main() {
  int m[100], n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> m[i];
  sort(m, m + n);
  swap(m[0], m[n - 1]);
  for (int i = 0; i < n; ++i) cout << m[i] << " ";
}
