#include <bits/stdc++.h>
using namespace std;
template <class T>
void dbg(const char* xn, T x) {
  if (0) cout << xn << ": " << x << "\n";
}
template <class T, class... TA>
void dbg(const char* xn, T x, TA... t) {
  while (*xn != ',')
    if (0) cout << *xn++;
  if (0) cout << ": " << x << ",";
  dbg(xn + 1, t...);
}
template <class T>
inline bool upd_max(T& x, T y) {
  return y > x ? x = y, true : false;
}
template <class T>
inline bool upd_min(T& x, T y) {
  return y < x ? x = y, true : false;
}
const int N = 1000007;
long long n, A[N];
map<long long, long long> cnt;
set<long long> S;
void solve() {
  cin >> n;
  for (long long i = 1; i <= (n); ++i) {
    cin >> A[i];
    ++cnt[A[i]];
    S.insert(A[i]);
  }
  if (((long long)(S).size()) == 1) {
    cout << n << '\n';
    for (long long i = 1; i <= (n); ++i) cout << A[i] << " ";
    exit(0);
  }
  if (((long long)(S).size()) == 2) {
    long long vMin = *S.begin();
    S.erase(S.begin());
    long long vMax = *S.begin();
    S.erase(S.begin());
    if (vMax == vMin + 1) {
      cout << n << '\n';
      for (long long i = 1; i <= (n); ++i) cout << A[i] << " ";
      exit(0);
    }
    long long vMid = vMin + 1;
    long long lim = min(cnt[vMin], cnt[vMax]);
    long long r2 = lim * 2;
    cout << n - r2 << '\n';
    for (long long i = 0; i < 2 * lim; ++i) cout << vMid << " ";
    for (long long i = lim; i < cnt[vMin]; ++i) cout << vMin << " ";
    for (long long i = lim; i < cnt[vMax]; ++i) cout << vMax << " ";
    exit(0);
  }
  long long vMin = *S.begin();
  S.erase(S.begin());
  long long vMid = *S.begin();
  S.erase(S.begin());
  long long vMax = *S.begin();
  S.erase(S.begin());
  long long r1 = (cnt[vMid] / 2) * 2;
  long long r2 = min(cnt[vMin], cnt[vMax]) * 2;
  cout << n - max(r1, r2) << '\n';
  if (r1 > r2) {
    if (cnt[vMid] & 1) cout << vMid << " ", --cnt[vMid];
    for (long long i = 0; i < cnt[vMid] / 2; ++i)
      cout << vMin << " " << vMax << " ";
    for (long long i = 0; i < cnt[vMin]; ++i) cout << vMin << " ";
    for (long long i = 0; i < cnt[vMax]; ++i) cout << vMax << " ";
  } else {
    long long lim = min(cnt[vMin], cnt[vMax]);
    for (long long i = 0; i < 2 * lim; ++i) cout << vMid << " ";
    for (long long i = lim; i < cnt[vMin]; ++i) cout << vMin << " ";
    for (long long i = lim; i < cnt[vMax]; ++i) cout << vMax << " ";
    for (long long i = 0; i < cnt[vMid]; ++i) cout << vMid << " ";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}
