#include <bits/stdc++.h>
using namespace std;
const long long A = 100000000000000LL, N = 228228;
vector<long long> b[N];
long long i, j, n, m, p[2], ot[2], k, o[N], t[N], a[N];
int main() {
  cin >> n;
  n *= 2;
  for (i = 0; i < n; i++) scanf("%d", &a[i]), b[a[i]].push_back(i);
  for (i = 0; i < n; i++)
    if (b[a[i]].size() > 1 && !t[a[i]]) {
      k = b[a[i]].size(), ot[0]++, ot[1]++;
      o[b[a[i]][k - 1]] = 1, o[b[a[i]][k - 2]] = 2, b[a[i]].resize(k - 2),
                    t[a[i]] = 1;
    }
  for (i = 0; i < n; i++)
    if (!o[i]) {
      if (!t[a[i]]) {
        if (ot[0] > ot[1])
          ot[1]++, o[i] = 2;
        else
          ot[0]++, o[i] = 1;
      }
    }
  p[0] = ot[0], p[1] = ot[1];
  for (i = 0; i < n; i++)
    if (!o[i]) {
      if (p[0] == n / 2)
        o[i] = 2, p[1]++;
      else
        o[i] = 1, p[0]++;
    }
  cout << ot[0] * ot[1] << "\n";
  for (i = 0; i < n; i++) cout << o[i] << " ";
}
