#include <bits/stdc++.h>
using namespace std;
int a[1100];
int b[1100];
int ans[1100];
int pos[1100];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    memset(ans, 0, sizeof(ans));
    memset(a, 0, sizeof(a));
    int tmp;
    for (int i = 0; i < n + n; i++) {
      scanf("%d", &tmp);
      b[i] = tmp;
      a[tmp]++;
    }
    int a1, a2;
    a1 = a2 = 0;
    int cnt1 = 0;
    int cnt2 = 0;
    for (int i = 0; i < 100; i++) {
      if (a[i] >= 2) cnt2++;
      if (a[i] == 1) cnt1++;
    }
    int cnt[3];
    int sum = (cnt2 + cnt1 - cnt1 / 2) * (cnt2 + cnt1 / 2);
    for (int i = 0; i < 100; i++)
      if (a[i] >= 2) {
        int k = 1;
        for (int j = 0; j < n + n; j++)
          if (b[j] == i && k <= 2) {
            cnt[k]++;
            ans[j] = k++;
          }
      }
    int top = 0;
    for (int i = 0; i < 100; i++)
      if (a[i] == 1) {
        for (int j = 0; j < n + n; j++)
          if (b[j] == i) {
            cnt[top % 2 + 1]++;
            ans[j] = top % 2 + 1;
            top++;
          }
      }
    for (int i = 0; i < n + n; i++)
      if (!ans[i]) ans[i] = top % 2 + 1, top++;
    printf("%d\n", sum);
    for (int i = 0; i < n + n; i++) printf("%d ", ans[i]);
    puts("");
  }
}
