#include <bits/stdc++.h>
using namespace std;
bool cmp(long long a, long long b) { return a > b; }
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  cout << (n - 1) / 2 << "\n";
  vector<long long> v(n);
  if (n % 2) {
    for (long long i = ((n - 1) / 2), j = 0; i < n && j < n; i++, j += 2) {
      v[j] = a[i];
    }
    for (long long i = 0, j = 1; i < ((n - 1) / 2) && j < n; j += 2, i++) {
      v[j] = a[i];
    }
  } else {
    for (long long i = ((n - 1) / 2) + 1, j = 0; i < n && j < n; i++, j += 2) {
      v[j] = a[i];
    }
    for (long long i = 0, j = 1; i <= ((n - 1) / 2) && j < n; j += 2, i++) {
      v[j] = a[i];
    }
  }
  for (auto i : v) {
    cout << i << " ";
  }
  cout << "\n";
}
