#include <bits/stdc++.h>
int n, a[100 + 1];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  std::sort(a + 1, a + n + 1);
  printf("%d ", a[n]);
  for (int i = 2; i < n; ++i) printf("%d ", a[i]);
  printf("%d\n", a[1]);
}
