#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
long long mod = (1e9 + 7);
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
bool is_vowel(char c) {
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return 1;
  return 0;
}
double getDistance(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
long long extended_euclidean(long long a, long long b, long long &x,
                             long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long g = extended_euclidean(b, a % b, y, x);
  y -= (a / b) * x;
  return g;
}
long long power(long long base, long long p) {
  if (p == 1) return base;
  if (!p) return 1ll;
  long long ret = power(base, p / 2);
  ret *= ret;
  ret %= mod;
  if (p & 1) ret *= base;
  return ret % mod;
}
vector<int> v;
map<int, int> mp;
int n;
int solve(long long sum, long long a, long long b, long long c) {
  v.clear();
  int mn = n, A = 0, B = 0, C = 0;
  for (int i = (0); i <= (n); ++i) {
    long long cur = sum - a * i;
    int cost = min(i, mp[a]);
    long long mx = c * (n - i);
    int taken2 = n - i;
    int taken1 = 0;
    if (mx > cur) {
      long long delta = mx - cur;
      taken2 -= delta;
      taken1 += delta;
      mx = cur;
    }
    if (mx == cur && taken1 + taken2 == n - i && taken1 >= 0 && taken2 >= 0) {
      cost += min(mp[b], taken1);
      cost += min(mp[c], taken2);
      mn = min(mn, cost);
      if (mn == cost) {
        A = i;
        B = taken1;
        C = taken2;
      }
    }
  }
  while (A--) v.push_back(a);
  while (B--) v.push_back(b);
  while (C--) v.push_back(c);
  return mn;
}
int main() {
  scanf("%d", &n);
  set<long long> st;
  long long sum = 0;
  vector<int> z;
  for (int i = (0); i <= (n - 1); ++i) {
    int a;
    scanf("%d", &a);
    st.insert(a);
    mp[a]++;
    sum += a;
    z.push_back(a);
  }
  vector<long long> x(st.begin(), st.end());
  long long mn = *(st.begin());
  long long mx = *(--st.end());
  int sol = n;
  if (abs(mn - mx) < 2) {
    cout << n << endl;
    for (int i = (0); i <= (n - 1); ++i) {
      cout << z[i] << ' ';
    }
    return 0;
  }
  sol = solve(sum, mn, mn + 1, mn + 2);
  cout << sol << endl;
  for (int i = (0); i <= (n - 1); ++i) cout << v[i] << ' ';
  return 0;
}
