#include <bits/stdc++.h>
using namespace std;
int n, a;
int cnt[110] = {0};
int cnt1 = 0, cnt2 = 0;
int zhan1[500];
int num[500];
int flag[500] = {0};
int main() {
  cin >> n;
  for (int i = 0; i < 2 * n; i++) {
    cin >> a;
    cnt[a]++;
    num[i] = a;
  }
  for (int i = 0; i < 2 * n; i++) {
    if (cnt[num[i]] >= 2) {
      if (flag[num[i]] == 0) {
        flag[num[i]]++;
        cnt1++;
        zhan1[i] = 1;
      } else if (flag[num[i]] == 1) {
        flag[num[i]]++;
        cnt2++;
        zhan1[i] = 2;
      } else
        zhan1[i] = 3;
    }
  }
  for (int i = 0; i < 2 * n; i++) {
    if (cnt[num[i]] == 1) {
      if (cnt1 < cnt2) {
        cnt1++;
        zhan1[i] = 1;
      } else {
        cnt2++;
        zhan1[i] = 2;
      }
    }
  }
  printf("%d\n", cnt1 * cnt2);
  for (int i = 0; i < 2 * n; i++) {
    if (zhan1[i] == 3) {
      if (cnt1 < n)
        printf("1 "), cnt1++;
      else
        printf("2 "), cnt2++;
    } else
      printf("%d ", zhan1[i]);
  }
}
