#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > AdjList;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int main() {
  int n;
  cin >> n;
  map<int, int> d[2], cs;
  vector<int> data, ans;
  int count[] = {0, 0};
  vector<int> dup;
  for (int i = 0; i < 2 * n; i++) {
    int in;
    cin >> in;
    data.push_back(in);
    ans.push_back(-1);
    cs[in]++;
  }
  for (int i = 0; i < 2 * n; i++) {
    if (cs[data[i]] > 2) {
      cs[data[i]]--;
      dup.push_back(i);
    }
  }
  int turn = 0;
  for (int i = 0; i < 2 * n; i++) {
    if (cs[data[i]] == 1) {
      count[turn]++;
      ans[i] = turn;
      turn = 1 - turn;
    }
  }
  while (dup.size()) {
    int _0 = dup.back();
    dup.pop_back();
    ans[_0] = turn;
    turn = 1 - turn;
  }
  for (int i = 0; i < 2 * n; i++) {
    if (ans[i] == -1) {
      if (cs[data[i]] == 2) {
        count[0]++;
        ans[i] = 0;
        cs[data[i]] = -2;
      } else if (cs[data[i]] == -2) {
        count[1]++;
        ans[i] = 1;
      }
    }
  }
  cout << count[0] * count[1] << endl;
  for (int i = 0; i < 2 * n; i++) {
    if (i) cout << ' ';
    cout << ans[i] + 1;
  }
  cout << endl;
}
