#include <bits/stdc++.h>
using namespace std;
int n, a[205], cnt[105], used[105], ans[205], sz[3];
int push(int x) {
  if (x) {
    sz[x]++;
    return x;
  } else if (sz[1] < sz[2]) {
    sz[1]++;
    return 1;
  } else {
    sz[2]++;
    return 2;
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n * 2; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  for (int i = 1; i <= n * 2; i++)
    if (cnt[a[i]] > 1 && used[a[i]] < 2) ans[i] = push(++used[a[i]]);
  for (int i = 1; i <= n * 2; i++)
    if (cnt[a[i]] == 1) ans[i] = push(0);
  cout << sz[1] * sz[2] << "\n";
  for (int i = 1; i <= n * 2; i++) {
    if (!ans[i]) ans[i] = push(0);
    cout << ans[i] << " ";
  }
}
