#include <bits/stdc++.h>
using namespace std;
map<int, int> m1, m2;
map<int, int>::iterator it;
int main() {
  int n;
  cin >> n;
  int x;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    m1[x]++;
  }
  int a = 0, b = 0, c = 0, xx, y, z;
  ;
  x = 0;
  if (m1.size() == 1) {
    it = m1.begin();
    a = it->first;
    printf("%d\n", n);
    while (n--) {
      printf("%d ", a);
    }
    cout << endl;
    return 0;
  }
  if (m1.size() == 2) {
    it = m1.begin();
    a = it->first;
    it++;
    b = it->first;
    if (a + 1 == b) {
      cout << n << endl;
      for (it = m1.begin(); it != m1.end(); it++) {
        n = it->first;
        a = it->second;
        while (a--) printf("%d ", n);
      }
      return 0;
    }
    int ans = n;
    it = m1.begin();
    a = it->second;
    xx = it->first;
    it++;
    b = 0;
    y = xx + 1;
    c = it->second;
    z = it->first;
    while (a && c) {
      a--;
      c--;
      b += 2;
      ans -= 2;
    }
    cout << ans << endl;
    while (a > 0) {
      printf("%d ", xx);
      a--;
    }
    while (b > 0) {
      printf("%d ", y);
      b--;
    }
    while (c > 0) {
      printf("%d", z);
      c--;
      if (c) printf(" ");
    }
    cout << endl;
    return 0;
  }
  for (it = m1.begin(); it != m1.end(); it++, x++) {
    if (x == 0) {
      a = it->second;
      xx = it->first;
    } else if (x == 1) {
      b = it->second;
      y = it->first;
    } else if (x == 2) {
      c = it->second;
      z = it->first;
    }
  }
  int ans = n;
  if (min(a, c) >= b / 2) {
    while (a && c) {
      a--;
      c--;
      b += 2;
      ans -= 2;
    }
  } else {
    while (b > 1) {
      ans -= 2;
      a++;
      c++;
      b -= 2;
    }
  }
  cout << ans << endl;
  while (a > 0) {
    printf("%d ", xx);
    a--;
  }
  while (b > 0) {
    printf("%d ", y);
    b--;
  }
  while (c > 0) {
    printf("%d", z);
    c--;
    if (c) printf(" ");
  }
  cout << endl;
}
