#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  cout << (n - !(n % 2)) / 2 << endl;
  sort(arr.begin(), arr.end());
  int p = 0, q = n - 1;
  while (p <= q) {
    if (p == q)
      cout << arr[p] << " ";
    else
      cout << arr[q] << " " << arr[p] << " ";
    p++;
    q--;
  }
}
