#include <bits/stdc++.h>
using namespace std;
long long ans1[100005], ans2[100005], ans3[100005];
long long ans[100005];
void construct(long long c, long long n, long long ce, long long cl,
               long long cg, long long av) {
  for (long long int i = 0; i < n; i++) {
    if (cl > 0) {
      ans[i] = av - 1;
      cl--;
    } else if (cg > 0) {
      ans[i] = av + 1;
      cg--;
    } else {
      ans[i] = av;
    }
  }
  if (c == 1) {
    for (long long int i = 0; i < n; i++) {
      ans1[i] = ans[i];
    }
  } else if (c == 2) {
    for (long long int i = 0; i < n; i++) {
      ans2[i] = ans[i];
    }
  } else {
    for (long long int i = 0; i < n; i++) {
      ans3[i] = ans[i];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n];
  long long sum = 0;
  vector<long long> v;
  map<long long, long long> vis;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    if (vis[a[i]] == 0) {
      v.push_back(a[i]);
      vis[a[i]] = 1;
    }
  }
  sort(v.begin(), v.end());
  long long av = (v[0] + v[v.size() - 1]) / 2;
  long long cl = 0, cg = 0, ce = 0;
  for (long long int i = 0; i < n; i++) {
    if (a[i] == av)
      ce++;
    else if (a[i] == av - 1)
      cl++;
    else
      cg++;
  }
  if (cl > 0 && cg > 0)
    construct(1, n, ce % 2, cl + (ce / 2), cg + (ce / 2), av);
  else
    construct(1, n, ce, cl, cg, av);
  construct(2, n, ce + 2 * min(cl, cg), cl - min(cl, cg), cg - min(cl, cg), av);
  construct(3, n, ce, cl, cg, av);
  sort(a, a + n);
  sort(ans1, ans1 + n);
  sort(ans2, ans2 + n);
  sort(ans3, ans3 + n);
  long long g1 = 0, g2 = 0, g3 = 0;
  for (long long int i = 0; i < n; i++) {
    if (ans1[i] == a[i]) g1++;
    if (ans2[i] == a[i]) g2++;
    if (ans3[i] == a[i]) g3++;
  }
  long long g = min(min(g1, g2), g3);
  if (g == g1) {
    cout << g1 << "\n";
    for (long long int i = 0; i < n; i++) cout << ans1[i] << " ";
  } else if (g == g2) {
    cout << g2 << "\n";
    for (long long int i = 0; i < n; i++) cout << ans2[i] << " ";
  } else {
    cout << g3 << "\n";
    for (long long int i = 0; i < n; i++) cout << ans3[i] << " ";
  }
  return 0;
}
