#include <bits/stdc++.h>
using namespace std;
void fldsmdfr() {}
int main() {
  fldsmdfr();
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) {
    int n, i, j, k, ans = 0;
    cin >> n;
    int a[n];
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    if (n % 2) {
      cout << n / 2 << "\n";
      int count = 0;
      for (i = 0; i < (n + 1) / 2; i++) {
        cout << a[i + n / 2] << " ";
        if (i != n / 2) cout << a[i] << " ";
      }
    } else {
      cout << (n / 2) - 1 << "\n";
      int count = 0;
      for (i = 0; i < (n + 1) / 2; i++) {
        cout << a[i + n / 2] << " ";
        cout << a[i] << " ";
      }
    }
  }
  return 0;
}
