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