#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  scanf("%d", &N);
  int A[N + 1];
  for (int i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
  }
  sort(A + 1, A + N + 1);
  swap(A[1], A[N]);
  sort(A + 2, A + N);
  printf("%d", A[1]);
  for (int i = 2; i <= N; i++) {
    printf(" %d", A[i]);
  }
  printf("\n");
  return 0;
}
