#include <bits/stdc++.h>
using namespace std;
vector<int> x[200];
int y[200], n, i, j, k, a, b, c, s, A, B;
int main() {
  scanf("%d", &n);
  n *= 2;
  for (i = 1; i <= n; i++) scanf("%d", &k), x[k].push_back(i);
  for (i = 10; i <= 99; i++)
    if (x[i].size() == 1) {
      if (a > b)
        y[x[i][0]] = 2, b++;
      else
        y[x[i][0]] = 1, a++;
    }
  s = a * b;
  A = a;
  B = b;
  for (i = 10; i <= 99; i++)
    if (x[i].size() > 1) {
      s += a + b;
      c++;
      for (j = 0; j < x[i].size(); j++) {
        if (A > B)
          y[x[i][j]] = 2, B++;
        else
          y[x[i][j]] = 1, A++;
      }
    }
  s += c * c;
  printf("%d\n", s);
  for (i = 1; i <= n; i++) printf("%d ", y[i]);
}
