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