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