#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  int n;
  cin >> n;
  n *= 2;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  map<int, int> mp;
  for (auto i : v) mp[i]++;
  bool f = 1;
  set<int> a, b;
  for (auto &i : mp) {
    if (i.second > 1) {
      i.second -= 2;
      a.insert(i.first);
      b.insert(i.first);
    } else {
      if (f)
        a.insert(i.first);
      else
        b.insert(i.first);
      f = !f;
    }
  }
  cout << a.size() * b.size() << endl;
  for (auto i : v)
    if (a.find(i) != a.end())
      cout << 1 << " ", a.erase(a.find(i));
    else if (b.find(i) != b.end())
      cout << 2 << " ", b.erase(b.find(i));
    else {
      if (f)
        cout << 1 << " ";
      else
        cout << 2 << " ";
      f = !f;
    }
}
