#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];
  sort(arr.begin(), arr.end());
  int i = 0, j = n - 1;
  vector<int> left;
  vector<int> right;
  while (i <= j) {
    right.push_back(arr[j--]);
    left.push_back(arr[i++]);
  }
  if ((arr.size() & 1) == 1) left.erase(left.begin() + left.size() - 1);
  int k = right.size() - 1;
  cout << k << '\n';
  int p = 0;
  for (int i = 0; i < right.size(); i++) {
    cout << right[i] << ' ';
    if (p < left.size()) cout << left[p++] << ' ';
  }
  return 0;
}
