#include <bits/stdc++.h>
int main() {
  int t, arr[110], i, l, s, m, n, j;
  scanf("%d", &t);
  l = -1;
  s = 1001;
  for (i = 0; i < t; i++) scanf("%d", &arr[i]);
  for (i = 0; i < t; i++) {
    for (j = i + 1; j < t; j++) {
      if (arr[j] < arr[i]) {
        s = arr[j];
        arr[j] = arr[i];
        arr[i] = s;
      }
    }
  }
  printf("%d ", arr[t - 1]);
  for (i = 1; i < t - 1; i++) {
    printf("%d ", arr[i]);
  }
  printf("%d\n", arr[0]);
  return 0;
}
