#include <bits/stdc++.h>
using namespace std;
int a[200010], b[4], c[4];
int js(int x, int y, int z) { return x + z + (y % 2); }
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int s;
  b[s = 1] = 1;
  c[1] = a[1];
  for (int i = 2; i <= n; ++i) {
    if (a[i] != a[i - 1]) {
      b[++s]++;
      c[s] = a[i];
    } else
      b[s]++;
  }
  if (s == 2 && c[1] == c[2] - 1) {
    printf("%d\n", n);
    for (int i = 1; i <= n; ++i) printf("%d ", a[i]);
    return 0;
  }
  if (s == 2 && c[1] == c[2] - 2)
    c[3] = c[2], b[3] = b[2], b[2] = 0, c[2] = c[1] + 1;
  int ans1 = n - 2 * min(b[1], b[3]);
  int ans2 = js(b[1], b[2], b[3]);
  if (ans1 < ans2) {
    printf("%d\n", ans1);
    for (int i = 1; i <= b[1] - min(b[1], b[3]); ++i) printf("%d ", c[1]);
    for (int i = 1; i <= b[2] + 2 * min(b[1], b[3]); ++i) printf("%d ", c[2]);
    for (int i = 1; i <= b[3] - min(b[1], b[3]); ++i) printf("%d ", c[3]);
  } else {
    printf("%d\n", ans2);
    for (int i = 1; i <= b[1] + b[2] / 2; ++i) printf("%d ", c[1]);
    for (int i = 1; i <= b[2] % 2; ++i) printf("%d ", c[2]);
    for (int i = 1; i <= b[3] + b[2] / 2; ++i) printf("%d ", c[3]);
  }
  return 0;
}
