#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int maxn = 100005;
int n;
int a[maxn];
int b[4];
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + n + 1);
  int cnt = 1;
  for (int i = 1; i <= n; ++i) {
    b[cnt]++;
    if (a[i] != a[i + 1] && i != n) cnt++;
  }
  if (cnt == 2 || cnt == 1) {
    if (a[n] - a[1] == 2) {
      cout << abs(b[1] - b[2]) << endl;
      if (b[1] > b[2]) {
        for (int i = 1; i <= abs(b[1] - b[2]); ++i) cout << a[1] << " ";
        for (int i = abs(b[1] - b[2]) + 1; i <= n; ++i)
          cout << (a[1] + a[n]) / 2 << " ";
      } else {
        for (int i = 1; i <= abs(b[1] - b[2]); ++i) cout << a[n] << " ";
        for (int i = abs(b[1] - b[2]) + 1; i <= n; ++i)
          cout << (a[1] + a[n]) / 2 << " ";
      }
    } else {
      cout << n << endl;
      for (int i = 1; i <= n; ++i) cout << a[i] << " ";
      cout << endl;
    }
  } else {
    int ans1 = abs(b[1] - b[3]) + b[2];
    int ans2 = b[2] % 2 + (b[1] + b[3]);
    if (ans1 <= ans2) {
      cout << ans1 << endl;
      if (b[1] > b[3]) {
        for (int i = 1; i <= b[1] - b[3]; ++i) cout << a[1] << " ";
        for (int i = b[1] - b[3] + 1; i <= n; ++i) cout << a[b[1] + 1] << " ";
      } else {
        for (int i = 1; i <= b[3] - b[1]; ++i) cout << a[n] << " ";
        for (int i = b[3] - b[1] + 1; i <= n; ++i) cout << a[b[1] + 1] << " ";
      }
    } else {
      cout << ans2 << endl;
      for (int i = 1; i <= b[1] + b[2] / 2; ++i) cout << a[1] << " ";
      for (int i = b[1] + b[2] / 2 + 1; i <= b[1] + b[2] / 2 + 1 + b[2] % 2 - 1;
           ++i)
        cout << a[b[1] + 1] << " ";
      for (int i = 1; i <= b[3] + b[2] / 2; ++i) cout << a[n] << " ";
    }
  }
  return 0;
}
