#include <bits/stdc++.h>
int compare(const void* a, const void* b) { return (*(int*)b - *(int*)a); }
int main() {
  int n, t;
  scanf("%d", &n);
  int arr[n];
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  qsort(arr, n, sizeof(int), compare);
  for (int i = 0; i < n; i++) {
    if (i == 0 || i == n - 1)
      printf("%d ", arr[i]);
    else
      printf("%d ", arr[n - i - 1]);
  }
  return 0;
}
