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