#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
const int MOD = 1e9 + 7;
const int dir[4][2] = {0, -1, 0, 1, -1, 0, 1, 0};
template <typename T>
inline void PE(T n, bool &flag) {
  flag ? printf(" ") : flag = 1;
  cout << n;
}
int qpow(int m, int a) {
  int ret = 1;
  for (; a; a >>= 1, m *= m) {
    if (a & 1) {
      ret *= m;
    }
  }
  return ret;
}
struct cube {
  int data;
  int loc;
  int cnt;
  int sta;
} a[205];
bool fordata(cube a, cube b) { return a.data < b.data; }
bool forcnt(cube a, cube b) {
  if (a.cnt == b.cnt) {
    return a.data < b.data;
  }
  return a.cnt < b.cnt;
}
bool forloc(cube a, cube b) { return a.loc < b.loc; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < 2 * n; i++) {
    scanf("%d", &a[i].data);
    a[i].loc = i;
    a[i].cnt = 0;
  }
  sort(a, a + 2 * n, fordata);
  int s = 0, t = 0, cnt = 0;
  a[2 * n].data = 1000;
  for (int i = 0; i <= 2 * n; i++) {
    if (a[s].data != a[i].data) {
      t = i;
      for (int j = s; j < t; j++) {
        a[j].cnt = cnt;
      }
      s = i;
      cnt = 1;
    } else {
      cnt++;
    }
  }
  sort(a, a + 2 * n, forcnt);
  int x = 0, y = 0, x1 = 1000, y1 = 1000;
  for (int i = 0; i < 2 * n; i++) {
    if (i & 1) {
      a[i].sta = 1;
      if (a[i].data != x1) {
        x++;
        x1 = a[i].data;
      }
    } else {
      a[i].sta = 2;
      if (a[i].data != y1) {
        y++;
        y1 = a[i].data;
      }
    }
  }
  sort(a, a + 2 * n, forloc);
  printf("%d", x * y);
  printf("\n");
  for (int i = 0; i < 2 * n; i++) {
    printf("%d", a[i].sta);
    printf(" ");
  }
  printf("\n");
  return 0;
}
