#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653589793;
const int INF = 1e9;
const double inf = 1e20;
const double eps = 1e-10;
const int mod = 1000000007;
struct E {
  int u, v, de;
} edge[100000 + 5];
int pre[100000 + 5];
int Find(int x) { return pre[x] == x ? x : pre[x] = Find(pre[x]); }
void Union(int x, int y) {
  int fx = Find(x);
  int fy = Find(y);
  if (fx != fy) pre[fx] = fy;
}
struct number {
  int num, id, heap;
} x[105];
bool cmp1(number a, number b) { return a.num < b.num; }
bool cmp2(number a, number b) { return a.id < b.id; }
int main() {
  int n;
  int a[105];
  int b[105];
  while (~scanf("%d", &n)) {
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    for (int i = 0; i < 2 * n; i++) {
      scanf("%d", &x[i].num);
      x[i].id = i;
      a[x[i].num]++;
    }
    int ans1 = 0, ans2 = 0;
    for (int i = 10; i < 100; i++) {
      if (a[i] == 1) ans1++;
      if (a[i] > 1) ans2++;
    }
    int t = ans1 / 2;
    int ans = (ans2 + t) * (ans2 + ans1 - t);
    printf("%d\n", ans);
    int count1 = 0, count2 = 0;
    sort(x, x + 2 * n, cmp1);
    for (int i = 0; i < 2 * n; i++) {
      int k = x[i].num;
      if (a[k] > 1) continue;
      if (count1 == count2) {
        x[i].heap = 1;
        count1++;
      } else {
        x[i].heap = 2;
        count2++;
      }
    }
    for (int i = 0; i < 2 * n; i++) {
      int k = x[i].num;
      if (a[k] == 1) continue;
      if (count1 == count2) {
        x[i].heap = 1;
        count1++;
      } else {
        x[i].heap = 2;
        count2++;
      }
    }
    sort(x, x + 2 * n, cmp2);
    for (int i = 0; i < 2 * n; i++) {
      if (i != 2 * n - 1)
        printf("%d ", x[i].heap);
      else
        printf("%d\n", x[i].heap);
    }
  }
  return 0;
}
