#include <bits/stdc++.h>
using namespace std;
int a[110], b[110];
int main() {
  int i, j, n, m, k;
  while (scanf("%d", &n) != EOF) {
    int maxn, minn;
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    sort(a, a + n);
    maxn = a[n - 1];
    minn = a[0];
    printf("%d ", maxn);
    for (i = 1; i < n - 1; i++) printf("%d ", a[i]);
    printf("%d\n", minn);
  }
  return 0;
}
