#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ans;
  if (n % 2 == 0) {
    ans = ((n / 2) - 1);
  } else {
    ans = (n / 2);
  }
  cout << ans << endl;
  sort(a, a + n);
  for (long long i = 0; i < (n - 1); i += 2) {
    swap(a[i], a[i + 1]);
  }
  for (long long i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
  cout << endl;
  return 0;
}
