#include <bits/stdc++.h>
using namespace std;
int n;
int a[100000 + 5];
int cnt[100000 + 5];
int ans[100000 + 5];
int main() {
  cin >> n;
  int stt = 0;
  int total[5];
  set<int> s[5];
  int k = n;
  total[0] = total[1] = 0;
  for (int i = (1), _b = (100); i <= _b; i++) cnt[i] = 0;
  for (int i = (1), _b = (2 * n); i <= _b; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  for (int i = (1), _b = (2 * n); i <= _b; i++) {
    if (cnt[a[i]] == 1) {
      total[stt]++;
      ans[i] = stt;
      s[stt].insert(a[i]);
      stt = 1 - stt;
      cnt[a[i]]--;
    }
  }
  for (int i = (1), _b = (2 * n); i <= _b; i++) {
    if (cnt[a[i]] >= 2) {
      if (total[0] <= total[1])
        stt = 0;
      else
        stt = 1;
      for (int j = (1), _b = (2 * n); j <= _b; j++) {
        if (a[j] == a[i]) {
          total[stt]++;
          ans[j] = stt;
          s[stt].insert(a[j]);
          if (total[1 - stt] < n) stt = 1 - stt;
          cnt[a[j]]--;
        }
      }
    }
  }
  printf("%d\n", (int)s[0].size() * (int)s[1].size());
  for (int i = (1), _b = (2 * n); i <= _b; i++) {
    printf("%d ", ans[i] + 1);
  }
  return 0;
}
