#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, switcher = 0;
  cin >> n;
  vector<int> inp(2 * n), out(2 * n);
  map<int, queue<int>> m;
  vector<pair<int, queue<int>>> m1;
  for (int i = 0; i < 2 * n; i++) {
    cin >> inp[i];
    m[inp[i] - 10].push(i);
  }
  for (auto &p : m) m1.push_back(p);
  sort(m1.begin(), m1.end(),
       [](const pair<int, queue<int>> &a, const pair<int, queue<int>> &b) {
         return a.second.size() > b.second.size();
       });
  for (auto &p : m1) {
    while (!p.second.empty()) {
      out[p.second.front()] = switcher + 1;
      switcher = (switcher + 1) % 2;
      p.second.pop();
    }
  }
  set<int> ones, twos;
  for (int i = 0; i < 2 * n; i++)
    if (out[i] == 1)
      ones.insert(inp[i]);
    else
      twos.insert(inp[i]);
  cout << ones.size() * twos.size() << "\n";
  for (auto &p : out) cout << p << " ";
  return 0;
}
