#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5;
vector<int> A[M];
int C[M];
vector<int> ans1, ans2;
int ans[M];
int main() {
  int n;
  scanf("%d", &n);
  for (int j = 1; j <= 2 * n; j++) {
    int a;
    scanf("%d", &a);
    A[a].push_back(j);
    C[j] = a;
  }
  vector<int> B;
  for (int j = 10; j <= 99; j++) {
    if (A[j].size() >= 2) {
      if (A[j].size() & 1) {
        for (int k = 0; k + 1 < A[j].size() - 1; k += 2) {
          ans1.push_back(A[j][k]);
          ans2.push_back(A[j][k + 1]);
        }
        B.push_back(A[j][A[j].size() - 1]);
      } else {
        for (int k = 0; k < A[j].size(); k += 2) {
          ans1.push_back(A[j][k]);
          ans2.push_back(A[j][k + 1]);
        }
      }
    } else if (A[j].size() == 1) {
      if (ans1.size() < ans2.size())
        ans1.push_back(A[j][0]);
      else
        ans2.push_back(A[j][0]);
    }
  }
  for (int j = 0; j < B.size(); j++) {
    if (ans1.size() < ans2.size())
      ans1.push_back(B[j]);
    else
      ans2.push_back(B[j]);
  }
  set<int> st, st1;
  for (int x : ans1) ans[x] = 1, st.insert(C[x]);
  for (int x : ans2) ans[x] = 2, st1.insert(C[x]);
  printf("%d\n", st.size() * st1.size());
  for (int j = 1; j <= 2 * n; j++) printf("%d ", ans[j]);
  printf("\n");
  return 0;
}
