#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long n;
  cin >> n;
  set<long long> un;
  vector<long long> vec(n);
  for (long long i = 0; i < n; i++) {
    cin >> vec[i];
    un.insert(vec[i]);
  }
  sort(vec.begin(), vec.end());
  if (un.size() == 1) {
    cout << n << endl;
    for (long long i = 0; i < n; i++) cout << vec[i] << " ";
  } else if (un.size() == 2) {
    long long v1 = *un.begin();
    un.erase(un.begin());
    long long v2 = *un.begin();
    if (v1 == v2 - 1) {
      cout << n << endl;
      for (long long i = 0; i < n; i++) cout << vec[i] << " ";
    } else {
      vector<long long> inp = vec;
      long long first = 0, second = 0;
      for (long long i = 0; i < n; i++)
        if (vec[i] == v1)
          first++;
        else
          second++;
      long long numb1 = min(first, second);
      long long numb2 = numb1;
      for (long long i = 0; i < n; i++) {
        if (vec[i] == v1 && numb1 > 0) {
          vec[i] = v1 + 1;
          numb1--;
        } else if (vec[i] == v2 && numb2 > 0) {
          vec[i] = v2 - 1;
          numb2--;
        }
      }
      sort(vec.begin(), vec.end());
      long long amount = 0;
      for (long long i = 0; i < n; i++)
        if (vec[i] == inp[i]) amount++;
      cout << amount << endl;
      for (long long i = 0; i < n; i++) cout << vec[i] << " ";
    }
  } else {
    long long v1 = *un.begin();
    un.erase(un.begin());
    un.erase(un.begin());
    long long v2 = *un.begin();
    vector<long long> inp = vec;
    long long first = 0, second = 0;
    for (long long i = 0; i < n; i++)
      if (vec[i] == v1)
        first++;
      else if (vec[i] == v2)
        second++;
    long long numb1 = min(first, second);
    long long numb2 = numb1;
    for (long long i = 0; i < n; i++) {
      if (vec[i] == v1 && numb1 > 0) {
        vec[i] = v1 + 1;
        numb1--;
      } else if (vec[i] == v2 && numb2 > 0) {
        vec[i] = v2 - 1;
        numb2--;
      }
    }
    sort(vec.begin(), vec.end());
    long long amount = 0;
    for (long long i = 0; i < n; i++)
      if (vec[i] == inp[i]) amount++;
    vector<long long> vec1 = inp;
    long long id;
    for (long long i = 0; i < n; i++) {
      if (vec1[i] == v2 - 1) {
        id = i;
        break;
      }
    }
    for (long long i = id; i < n; i += 2) {
      if (vec1[i] == vec1[i + 1] && vec1[i] == v2 - 1) {
        vec1[i] = v1;
        vec1[i + 1] = v2;
      } else
        break;
    }
    sort(vec1.begin(), vec1.end());
    long long amount1 = 0;
    for (long long i = 0; i < n; i++)
      if (vec1[i] == inp[i]) amount1++;
    if (amount < amount1) {
      cout << amount << endl;
      for (long long i = 0; i < n; i++) cout << vec[i] << " ";
    } else {
      cout << amount1 << endl;
      for (long long i = 0; i < n; i++) cout << vec1[i] << " ";
    }
  }
  return 0;
}
