#include <bits/stdc++.h>
using namespace std;
int32_t main(int32_t argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  while (T--) {
    long long n;
    cin >> n;
    long long arr[n];
    for (long long i = 0; i < n; i++) cin >> arr[i];
    long long ans = (n - 1) / 2, tem = ans;
    sort(arr, arr + n);
    cout << ans << endl;
    for (long long i = 0; i < n; i++) {
      if (tem != 0) {
        if (i % 2 == 0) {
          swap(arr[i], arr[i + 1]);
          --tem;
        }
      }
    }
    for (long long i = 0; i < n; i++) {
      cout << arr[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
