#include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
int a[maxn], s[maxn], f[maxn], n, ans;
int pmin, pmax;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i), f[i] = -1;
  sort(a, a + n);
  swap(a[0], a[n - 1]);
  for (int i = 0; i < n; i++) printf("%d ", a[i]);
  printf("\n");
  return 0;
}
