#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> vec(2 * n);
  vector<int> res(2 * n);
  vector<int> heap1;
  vector<int> heap2;
  for (auto& x : vec) cin >> x;
  int cur = 0;
  map<int, vector<int>> m;
  for (int i = 0; i < 2 * n; i++) {
    m[vec[i]].push_back(i);
  }
  for (auto& x : m) {
    auto& idx = x.second;
    if (idx.size() >= 2) {
      res[idx[0]] = cur + 1;
      cur = (cur + 1) % 2;
      res[idx[1]] = cur + 1;
      cur = (cur + 1) % 2;
    }
  }
  for (auto& x : m) {
    auto& idx = x.second;
    if (idx.size() == 1) {
      res[idx[0]] = cur + 1;
      cur = (cur + 1) % 2;
    }
  }
  for (auto& x : m) {
    auto& idx = x.second;
    if (idx.size() > 2) {
      for (int i = 2; i < idx.size(); i++) {
        res[idx[i]] = cur + 1;
        cur = (cur + 1) % 2;
      }
    }
  }
  for (int i = 0; i < res.size(); i++) {
    if (res[i] == 1)
      heap1.push_back(vec[i]);
    else
      heap2.push_back(vec[i]);
  }
  set<int> ss;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      ss.insert(heap1[i] * 100 + heap2[j]);
    }
  }
  cout << ss.size() << '\n';
  for (auto& x : res) cout << x << ' ';
  cout << '\n';
  return 0;
}
