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