#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
long long int n;
long long int t[2 * N];
int main() {
  int n;
  cin >> n;
  long long int a[n], sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a, a + n);
  int c = 1, g = a[0];
  int mc = 0, mx = 0;
  int c1 = a[0];
  int val = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] != c1) {
      val = a[i];
      break;
    }
    mc++;
  }
  c1 = a[n - 1];
  for (int i = n - 1; i >= 0 && a[i] == c1; i--) {
    mx++;
  }
  if (a[n - 1] == a[0] && (a[0] == val || val == 0)) {
    c = 1;
  } else if (a[0] != a[n - 1] && a[0] != val && val != a[n - 1]) {
    c = 3;
  } else {
    c = 2;
  }
  if (c == 1) {
    cout << n << '\n';
    for (int i = 0; i < n; i++) {
      cout << a[i] << " ";
    }
  } else if (c == 2) {
    if (a[n - 1] - a[0] == 1) {
      cout << n << '\n';
      for (int i = 0; i < n; i++) {
        cout << a[i] << " ";
      }
    } else {
      if (mx == mc) {
        cout << n - mx - mc << '\n';
        for (int i = 0; i < n; i++) {
          cout << a[0] + 1 << " ";
        }
      } else if (mx > mc) {
        cout << n - 2 * (mc) << '\n';
        for (int i = 0; i < n - (mx) + mc; i++) {
          cout << a[0] + 1 << " ";
        }
        for (int i = n - (mx) + mc; i < n; i++) {
          cout << a[n - 1] << " ";
        }
      } else if (mc > mx) {
        cout << n - 2 * (mx) << '\n';
        for (int i = 0; i < n - (mc) + mx; i++) {
          cout << a[0] + 1 << " ";
        }
        for (int i = n - (mc) + mx; i < n; i++) {
          cout << a[0] << " ";
        }
      }
    }
  } else if (c == 3) {
    if (2 * min(mx, mc) >= ((n - mx - mc) / 2) * 2) {
      if (mx == mc) {
        cout << n - mx - mc << '\n';
        for (int i = 0; i < n; i++) {
          cout << val << " ";
        }
      } else if (mx > mc) {
        cout << n - 2 * (mc) << '\n';
        for (int i = 0; i < n - (mx) + mc; i++) {
          cout << val << " ";
        }
        for (int i = n - (mx) + mc; i < n; i++) {
          cout << a[n - 1] << " ";
        }
      } else if (mc > mx) {
        cout << n - 2 * (mx) << '\n';
        for (int i = 0; i < n - (mc) + mx; i++) {
          cout << val << " ";
        }
        for (int i = n - (mc) + mx; i < n; i++) {
          cout << a[0] << " ";
        }
      }
    } else {
      if ((n - mx - mc) % 2 == 0) {
        cout << mx + mc << '\n';
        for (int i = 0; i < mc + (n - mx - mc) / 2; i++) {
          cout << a[0] << " ";
        }
        for (int i = mc + (n - mx - mc) / 2; i < n; i++) {
          cout << a[n - 1] << " ";
        }
      } else {
        cout << mx + mc + 1 << '\n';
        for (int i = 0; i < mc + (n - mx - mc) / 2; i++) {
          cout << a[0] << " ";
        }
        for (int i = mc + (n - mx - mc) / 2; i < n - 1; i++) {
          cout << a[n - 1] << " ";
        }
        cout << val << '\n';
      }
    }
  }
  return 0;
}
