#include <bits/stdc++.h>
using namespace std;
int n;
int x[33333];
int C[33333];
int BB[33333];
int seen[33333];
int seena[33333];
int main() {
  scanf("%d", &n);
  int cc = 0;
  for (int i = 0; i < 2 * n; i++) {
    scanf("%d", &x[i]);
    C[x[i]]++;
    BB[x[i]]++;
  }
  int ca = 0, cb = 0;
  vector<int> res(2 * n, 0);
  for (int i = 0; i < 2 * n; i++) {
    if (C[x[i]] == 1) {
      cc++;
      if (cc % 2) {
        res[i] = 1;
        ca++;
      } else {
        res[i] = 2;
        cb++;
      }
    } else {
      if (seena[x[i]] == 0) {
        res[i] = 1;
        ca++;
      } else if (seena[x[i]] == 1) {
        res[i] = 2;
        cb++;
      }
      seena[x[i]]++;
    }
  }
  for (int i = 0; i < 2 * n; i++) {
    if (res[i] == 0) {
      if (ca < n) {
        res[i] = 1;
        ca++;
      } else
        res[i] = 2;
    }
  }
  int can = 0;
  vector<int> A, B;
  for (int i = 0; i < 2 * n; i++) {
    if (res[i] == 1)
      A.push_back(x[i]);
    else
      B.push_back(x[i]);
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      int nn = A[i] * 100 + B[j];
      if (!seen[nn]) can++;
      seen[nn] = 1;
    }
  printf("%d\n", can);
  printf("%d", res[0]);
  for (int i = 1; i < 2 * n; i++) {
    printf(" %d", res[i]);
  }
  printf("\n");
  return 0;
}
