#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long &e : a) cin >> e;
  sort(a.begin(), a.end());
  cout << n / 2 - (1 - n % 2) << '\n';
  for (long long i = n / 2; i < n; ++i) {
    cout << a[i] << ' ';
    if (i != n - 1)
      cout << a[i - n / 2] << ' ';
    else {
      if (n % 2 == 0) cout << a[i - n / 2] << ' ';
    }
  }
}
