#include <bits/stdc++.h>
using namespace std;
const long long M = 1e5 + 6;
const long long mod = 1e9 + 7;
const long double esl = 1e-5;
int n, a[M], amax = INT_MIN, amin = INT_MAX, cmax, cmin, ctb, ansmax, ansmin,
             anstb, ans = INT_MAX;
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    amin = min(a[i], amin);
    amax = max(a[i], amax);
  }
  int tb = (amin + amax) / 2;
  if (amax - amin == 0 || amax - amin == 1) {
    cout << n << endl;
    for (int i = 0; i < n; i++) cout << a[i] << " ";
    return;
  }
  for (int i = 0; i < n; i++) {
    if (a[i] == amax)
      cmax++;
    else {
      if (a[i] == amin)
        cmin++;
      else
        ctb++;
    }
  }
  for (int i = ctb, ctmax = cmax, ctmin = cmin; ctmax >= 0 && ctmin >= 0;
       i += 2, ctmax--, ctmin--) {
    int t = ctmax + ctmin + ctb;
    if (t < ans) {
      ans = t;
      ansmax = ctmax;
      ansmin = ctmin;
      anstb = i;
    }
  }
  for (int i = ctb, ctmax = cmax, ctmin = cmin; i >= 0;
       i -= 2, ctmax++, ctmin++) {
    int t = cmax + cmin + i;
    if (t < ans) {
      ans = t;
      ansmax = ctmax;
      ansmin = ctmin;
      anstb = i;
    }
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    if (ansmax) {
      cout << amax << " ";
      ansmax--;
    } else {
      if (anstb) {
        cout << tb << " ";
        anstb--;
      } else
        cout << amin << " ";
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  solve();
  return 0;
}
