#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int j = 1;
  for (int i = 0; i < n / 2; i++) {
    b[j] = a[i];
    j += 2;
  }
  j = 0;
  for (int i = n / 2; i < n; i++) {
    b[j] = a[i];
    j += 2;
  }
  if (n > 2) {
    if (n % 2 == 0)
      cout << n / 2 - 1 << endl;
    else
      cout << n / 2 << endl;
  } else
    cout << 0 << endl;
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  return 0;
}
