#include <bits/stdc++.h>
using namespace std;
void flash() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
void solve() {
  long long n;
  cin >> n;
  long long a[n + 10];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  sort(a, a + n);
  long long j = n - 1;
  long long i = 0;
  cout << (n - 1) / 2 << "\n";
  for (long long k = 0; k < n; k++) {
    if (k % 2) {
      cout << a[i++] << " ";
    } else {
      cout << a[j--] << " ";
    }
  }
}
int32_t main() {
  flash();
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
