#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(2 * n);
  vector<int> posicion(2 * n, 0);
  map<int, int> veces;
  map<int, int> posprimera, possegunda;
  for (int i = 0; i < 2 * n; i++) {
    cin >> v[i];
    veces[v[i]]++;
    if (veces[v[i]] == 1)
      posprimera[v[i]] = i;
    else if (veces[v[i]] == 2)
      possegunda[v[i]] = i;
  }
  int amount1 = 0, amount2 = 0;
  for (map<int, int>::iterator it = veces.begin(); it != veces.end(); it++) {
    if (it->second == 1) {
      if (amount1 == amount2) {
        posicion[posprimera[it->first]] = 1;
        amount1++;
      } else {
        posicion[posprimera[it->first]] = 2;
        amount2++;
      }
    } else {
      posicion[posprimera[it->first]] = 1;
      posicion[possegunda[it->first]] = 2;
      amount1++;
      amount2++;
    }
  }
  cout << amount1 * amount2 << endl;
  for (int i = 0; i < 2 * n; i++) {
    if (posicion[i] == 0) {
      if (amount1 < n) {
        posicion[i] = 1;
        amount1++;
      } else
        posicion[i] = 2;
    }
    if (i > 0) cout << " ";
    cout << posicion[i];
  }
  cout << endl;
}
