#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n;
  cin >> n;
  n *= 2;
  pair<int, int> arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first;
    arr[i].second = i;
  }
  sort(arr, arr + n);
  set<int> st1, st2;
  int f = 0;
  int p[n];
  for (int i = 0; i < n; i++) p[i] = -1;
  ;
  vector<int> inds;
  for (int i = 0; i < n; i++) {
    if (f == 0 && st1.find(arr[i].first) == st1.end()) {
      st1.insert(arr[i].first);
      f = 1 - f;
      p[arr[i].second] = 1;
    } else if (f == 1 && st2.find(arr[i].first) == st2.end()) {
      st2.insert(arr[i].first);
      f = 1 - f;
      p[arr[i].second] = 2;
    } else
      inds.push_back(arr[i].second);
  }
  long long ans = st1.size() * st2.size();
  cout << ans << endl;
  int i = 0;
  if (st1.size() > st2.size())
    p[inds[0]] = 2, i++;
  else if (st2.size() > st2.size())
    p[inds[0]] = 1, i++;
  f = 0;
  for (; i < inds.size(); i++) {
    if (f == 0)
      p[inds[i]] = 1, f = 1 - f;
    else
      p[inds[i]] = 2, f = 1 - f;
  }
  for (auto b : p) cout << b << " ";
  cout << endl;
}
