#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
void solve(long long cas) {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end(), greater<long long>());
  vector<long long> v(n);
  long long j = 0;
  for (long long i = 0; i < n; i += 2) {
    v[i] = a[j++];
  }
  for (long long i = 1; i < n; i += 2) {
    v[i] = a[j++];
  }
  cout << (n - 1) / 2 << endl;
  for (long long x : v) cout << x << ' ';
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long qu = 1;
  for (long long cas = 1; cas <= qu; cas++) {
    solve(cas);
  }
}
