#include <bits/stdc++.h>   using namespace std;   int main(int argc, char* argv[]) {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long i, t, n, com, midc;     cin >> n;     map<int, int> m;     set<int> s;     vector<int> x(n);     vector<int> a(3);     for (i = 0; i < n; i++) {       cin >> x[i];       m[x[i]]++;       s.insert(x[i]);     }     t = s.size();     if (t == 1) {       cout << n << endl;       for (i = 0; i < n; i++) cout << x[i] <<    ;       cout << endl;     } else if (t == 2) {       i = 0;       for (set<int>::const_iterator it = s.begin(); it != s.end(); it++) {         a[i] = *it;         i++;       }       if (abs(a[0] - a[1]) == 1) {         cout << n << endl;         for (i = 0; i < n; i++) cout << x[i] <<    ;         cout << endl;       } else {         com = min(m[a[0]], m[a[1]]);         cout << n - (2 * com) << endl;         ;         for (i = 0; i < (2 * com); i++) cout << a[0] + 1 <<    ;         for (i = 0; i < m[a[0]] - com; i++) cout << a[0] <<    ;         for (i = 0; i < m[a[1]] - com; i++) cout << a[1] <<    ;         cout << endl;       }     } else {       i = 0;       for (set<int>::const_iterator it = s.begin(); it != s.end(); it++) {         a[i] = *it;         i++;       }       midc = m[a[1]] / 2;       com = min(m[a[0]], m[a[2]]);       if (midc > com) {         cout << n - (midc * 2) << endl;         for (i = 0; i < midc; i++) {           cout << a[0] <<    ;           cout << a[2] <<    ;         }         for (i = 0; i < m[a[0]]; i++) cout << a[0] <<    ;         for (i = 0; i < m[a[2]]; i++) cout << a[2] <<    ;         if (m[a[1]] % 2) cout << a[1];         cout << endl;       } else {         cout << n - (2 * com) << endl;         for (i = 0; i < m[a[1]]; i++) cout << a[1] <<    ;         for (i = 0; i < (2 * com); i++) cout << a[1] <<    ;         for (i = 0; i < m[a[0]] - com; i++) cout << a[0] <<    ;         for (i = 0; i < m[a[2]] - com; i++) cout << a[2] <<    ;         cout << endl;       }     }     return 0;   }   