#include <bits/stdc++.h>
using namespace std;
vector<int> q;
int main(void) {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    q.push_back(x);
  }
  sort(q.begin(), q.end());
  int l = 0, r = n - 1, cnt = 1;
  int x;
  if (n % 2 == 0) {
    x = n / 2;
    x -= 1;
  } else {
    n -= 1;
    x = n / 2;
  }
  cout << x << endl;
  while (l <= r) {
    if (cnt++ % 2 == 0)
      cout << q[l++] << ' ';
    else
      cout << q[r--] << ' ';
  }
  return 0;
}
