#include <bits/stdc++.h>
using namespace std;
int n, tot;
int a[100005], b1[100005], b2[100005];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n >> 1; i++) {
    b1[i] = a[i];
  }
  for (int j = n / 2 + 1; j <= n; j++) {
    b2[++tot] = a[j];
  }
  if (n % 2 == 0) {
    printf("%d\n", n / 2 - 1);
    for (int i = 1; i <= n >> 1; i++) {
      printf("%d %d ", b2[i], b1[i]);
    }
  } else {
    printf("%d\n", n / 2);
    for (int i = 1; i <= n >> 1; i++) {
      printf("%d %d ", b2[i], b1[i]);
    }
    printf("%d", b2[tot]);
  }
  return 0;
}
