#include <bits/stdc++.h>
using namespace std;
const int maxn = 1100;
int xx[maxn], yy[maxn];
int mp[maxn];
int q, w;
struct node {
  int val;
  int id;
  friend bool operator<(const node A, const node B) { return A.val < B.val; }
} a[maxn];
bool cmp(node A, node B) { return A.id < B.id; }
int main() {
  int n;
  while (cin >> n) {
    memset(xx, 0, sizeof(xx));
    memset(yy, 0, sizeof(yy));
    memset(mp, 0, sizeof(mp));
    int c1 = 0, c2 = 0, d = 0;
    for (int i = 1; i <= 2 * n; i++) {
      cin >> a[i].val;
      a[i].id = i;
    }
    sort(a + 1, a + 2 * n + 1);
    int d1 = 0, d2 = 0;
    for (int i = 1; i <= 2 * n; i++) {
      if (!xx[a[i].val] && c1 <= c2) {
        xx[a[i].val] = 1;
        c1++;
        mp[a[i].id] = 1;
      } else if (!yy[a[i].val]) {
        yy[a[i].val] = 1;
        c2++;
        mp[a[i].id] = 2;
      } else {
        if (d % 2 == 0)
          mp[a[i].id] = 1, d1++, q = a[i].id;
        else
          mp[a[i].id] = 2, d2++, w = a[i].id;
        d++;
      }
    }
    int ans = c1 * c2;
    if (c1 + d1 != c2 + d2) {
      if (c1 + d1 > c2 + d2)
        mp[q] = 2;
      else
        mp[w] = 1;
    }
    cout << ans << endl;
    sort(a + 1, a + 2 * n + 1, cmp);
    for (int i = 1; i <= 2 * n; i++) cout << mp[a[i].id] << endl;
  }
}
