#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[n];
  map<int, int> m;
  int mn = INT_MAX;
  int mx = INT_MIN;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mn = min(mn, a[i]);
    mx = max(mx, a[i]);
    m[a[i]]++;
  }
  int d = mx - mn;
  int c = n;
  if (d == 2) {
    if ((min(m[mn], m[mx]) * 2) > m[mn + 1]) {
      while (m[mn] > 0 && m[mx] > 0) {
        m[mn]--;
        m[mx]--;
        m[mn + 1] += 2;
        c -= 2;
      }
    } else {
      while (m[mn + 1] >= 2) {
        m[mn + 1] -= 2;
        c -= 2;
        m[mx]++;
        m[mn]++;
      }
    }
  }
  cout << c << '\n';
  for (int i = mn; i <= mx; i++) {
    for (int j = 0; j < m[i]; j++) cout << i << " ";
  }
  return 0;
}
