#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[100000 + 1];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int res = (n - 1) / 2;
  cout << res << endl;
  for (int i = 0; i < n / 2; i++) {
    cout << a[n - 1 - i] << " ";
    cout << a[i] << " ";
  }
  if (n % 2 == 1) cout << a[n / 2];
  return 0;
}
