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