#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
int n, m, sum1, sum2;
pair<int, int> por[300];
int unic[101], unic1[101], kar, kar1;
int main() {
  cin >> n;
  for (int i = 0; i < 2 * n; ++i) {
    int t;
    cin >> t;
    unic[t]++;
    unic1[t] = 1;
    por[i].first = t;
  }
  for (int i = 0; i < 101; ++i) {
    if (unic[i] > 1) kar++;
    if (unic[i] == 1) kar1++;
  }
  kar1 += kar * 2;
  int ka1 = kar1 / 2, ka2 = kar1 - ka1;
  int nak = n - ka1, nak2 = n - ka2;
  cout << ka1 * ka2 << endl;
  for (int i = 0; i < 2 * n; ++i) {
    if (unic[por[i].first] == 1000) {
      por[i].second = 2;
      ka2--;
      unic[por[i].first] = 0;
      continue;
    }
    if (unic[por[i].first] > 1) {
      por[i].second = 1;
      ka1--;
      unic[por[i].first] = 1000;
    }
  }
  for (int i = 0; i < 2 * n; ++i) {
    if (ka1 == 0) break;
    if (unic[por[i].first]) {
      por[i].second = 1;
      ka1--;
      unic[por[i].first] = 0;
    }
  }
  for (int i = 0; i < 2 * n; ++i) {
    if (ka2 == 0) break;
    if (unic[por[i].first]) {
      por[i].second = 2;
      ka2--;
      unic[por[i].first] = 0;
    }
  }
  for (int i = 0; i < 2 * n; ++i) {
    if (nak2 == 0) break;
    if (por[i].second == 0) {
      por[i].second = 2;
      nak2--;
    }
  }
  for (int i = 0; i < 2 * n; ++i) {
    if (nak == 0) break;
    if (por[i].second == 0) {
      por[i].second = 1;
      nak--;
    }
  }
  for (int i = 0; i < 2 * n; ++i) cout << por[i].second << ' ';
}
