#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265;
int dx[] = {0, -1, 0, 1};
int dy[] = {-1, 0, 1, 0};
void fastInOut();
const int N = 102;
int a[N];
int main() {
  fastInOut();
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  cout << a[n - 1] << ' ';
  for (int i = 1; i < n - 1; i++) cout << a[i] << ' ';
  cout << a[0];
  return 0;
}
void fastInOut() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
}
