#include <bits/stdc++.h>
const int Maxn = 1000 * 1000 + 10;
using namespace std;
int main() {
  vector<int> A[10000];
  int B[10000];
  int n;
  cin >> n;
  n *= 2;
  int e[10000];
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    A[a].push_back(i);
    B[i] = a;
  }
  bool k = true;
  int size1 = 0, size2 = 0;
  int s1 = 0, s2 = 0;
  for (int i = 10; i <= 99; i++) {
    if (A[i].size() > 1) {
      for (int j = 0; j < 2; j++) {
        if (j % 2 == 0)
          e[A[i][A[i].size() - 1]] = 1;
        else
          e[A[i][A[i].size() - 1]] = 2;
        A[i].pop_back();
      }
      s1++;
      s2++;
      size1++;
      size2++;
    } else if (A[i].size() == 0)
      continue;
    else {
      if (k) {
        e[A[i][0]] = 1;
        size1++;
        s1++;
      } else {
        s2++;
        size2++;
        e[A[i][0]] = 2;
      }
      k = !k;
      A[i].pop_back();
    }
  }
  cout << s1 * s2 << endl;
  for (int i = 0; i < n; i++) {
    while (!A[B[i]].empty()) {
      if (size1 < n / 2) {
        e[A[B[i]][A[B[i]].size() - 1]] = 1;
        size1++;
        A[B[i]].pop_back();
      } else {
        e[A[B[i]][A[B[i]].size() - 1]] = 2;
        size2++;
        A[B[i]].pop_back();
      }
    }
  }
  for (int i = 0; i < n; i++) {
    cout << e[i] << " ";
  }
  cout << endl;
  return 0;
}
