#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> arr(n), newArr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr.rbegin(), arr.rend());
  if (n % 2 == 1) {
    cout << n / 2 << endl;
    for (int i = 0; i < n - n / 2; i++) {
      newArr[2 * i] = arr[i];
    }
    for (int i = n - n / 2; i < n; i++) {
      int curr = i - (n - n / 2);
      newArr[2 * curr + 1] = arr[i];
    }
  } else {
    cout << n / 2 - 1 << endl;
    newArr[0] = arr[0];
    newArr[n - 1] = arr[1];
    int toAdd = (n - 2) / 2;
    for (int i = 0; i < toAdd; i++) {
      newArr[1 + 2 * i] = arr[i + 2];
    }
    for (int i = 0; i < toAdd; i++) {
      newArr[2 + 2 * i] = arr[2 + toAdd + i];
    }
  }
  for (int i = 0; i < n; i++) {
    cout << newArr[i] << (i == n - 1 ? "" : " ");
  }
  cout << endl;
}
void unitTesting() {}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  solve();
  return 0;
}
