#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int get_mod(int a, int m) { return (a % m + m) % m; }
void solve() {
  long long int n;
  cin >> n;
  vector<int> arr(n);
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  long long int d = n / 2;
  if (n % 2 == 0) d--;
  cout << d << endl;
  if (n == 1) {
    cout << arr[0] << endl;
    return;
  }
  if (n == 2) {
    cout << arr[0] << " " << arr[1] << endl;
    return;
  }
  sort(arr.begin(), arr.end());
  vector<int> mid;
  for (int i = 0; i < d; i++) {
    mid.push_back(arr[i]);
  }
  sort(mid.rbegin(), mid.rend());
  for (int i = d; i < n; i++) {
    cout << arr[i] << " ";
    if (mid.size() > 0) {
      cout << mid.back() << " ";
      mid.pop_back();
    }
  }
  cout << endl;
}
int main() { solve(); }
