#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long x, n, a, b = 0, c = 0, d = 0;
  cin >> n;
  vector<long long> v;
  for (int i = 0; i < n; i++) {
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  cout << (n - 1) / 2 << endl;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0)
      cout << v[n - 1 - i / 2] << ' ';
    else
      cout << v[(i - 1) / 2] << ' ';
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tt = 1;
  while (tt--) {
    solve();
  }
}
