#include <bits/stdc++.h>
using namespace std;
void funct(vector<int>& ar) {
  sort(ar.begin(), ar.end());
  vector<int> v(ar.size());
  int p = (ar.size() + 1) / 2 - 1;
  cout << p << endl;
  int ind = 1;
  for (int i = 0; i < p; i++) {
    v[ind] = ar[i];
    ind = ind + 2;
  }
  ind = 0;
  for (int i = 0; i <= p; i++) {
    v[ind] = ar[i + p];
    ind = ind + 2;
  }
  if (ar.size() % 2 == 0) {
    v[ar.size() - 1] = ar[ar.size() - 1];
  }
  for (int i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
  }
  cout << endl;
}
int main() {
  int n;
  cin >> n;
  vector<int> ar(n);
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  funct(ar);
  return 0;
}
