#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e2 + 7;
int a[MAXN], ans[MAXN];
vector<int> cev[MAXN];
int main() {
  int n;
  cin >> n;
  n *= 2;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cev[a[i]].push_back(i);
  }
  int sza = 0, szb = 0;
  int shit = 0;
  for (int i = 0; i < MAXN; ++i)
    if (cev[i].size() == 1) {
      if (shit)
        ans[cev[i][0]] = 2, szb++;
      else
        ans[cev[i][0]] = 1, sza++;
      shit ^= 1;
      cev[i].clear();
    }
  for (int i = 0; i < MAXN; ++i) {
    if (cev[i].empty()) continue;
    while (!cev[i].empty()) {
      ans[cev[i].back()] = shit + 1;
      shit ^= 1;
      cev[i].pop_back();
    }
    sza++;
    szb++;
  }
  cout << sza * szb << "\n";
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  cout << "\n";
  return 0;
}
