#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  vector<int> result(n);
  int j = 0;
  for (int i = 1; i < n; i += 2, j++) {
    result[i] = arr[j];
  }
  for (int i = 0; i < n; i += 2, j++) {
    result[i] = arr[j];
  }
  cout << (n - 1) / 2 << endl;
  for (int i = 0; i < result.size(); i++) {
    cout << result[i] << " ";
  }
  cout << endl;
  return 0;
}
