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