#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  for (long long i = 0; i + 1 < n; i += 2) {
    swap(v[i], v[i + 1]);
  }
  cout << (n - 1) / 2 << endl;
  for (auto x : v) cout << x << ' ';
  cout << endl;
}
signed main() {
  long long t = 1;
  while (t--) solve();
}
