#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int b[2 * n], index[2 * n];
  set<long long int> s;
  vector<pair<long long int, long long int> > v[100];
  for (long long int i = 0; i < (2 * n); i++) {
    cin >> b[i];
    s.insert(b[i]);
    v[b[i]].push_back({i, -1});
  }
  long long int s1 = 0, s2 = 0;
  for (long long int i = 99; i >= 0; i--) {
    if (v[i].size() > 1) {
      s1++;
      s2++;
      v[i][0].second = 1;
      index[v[i][0].first] = 1;
      v[i][1].second = 2;
      index[v[i][1].first] = 2;
    }
  }
  long long int pre = 1;
  for (long long int i = 99; i >= 0; i--) {
    if (v[i].size() == 1) {
      v[i][0].second = pre;
      index[v[i][0].first] = pre;
      if (pre == 1)
        pre += 1, s1++;
      else
        pre -= 1, s2++;
    }
  }
  cout << s1 * s2 << endl;
  for (long long int i = 99; i >= 0; i--) {
    for (long long int j = 1; j < v[i].size(); j++) {
      if (v[i][j].second != -1) continue;
      if (s1 < n) {
        s1++;
        v[i][j].second = 1;
        index[v[i][j].first] = 1;
      } else {
        s2++;
        v[i][j].second = 2;
        index[v[i][j].first] = 2;
      }
    }
  }
  for (long long int i = 0; i < 2 * n; i++) cout << index[i] << " ";
  cout << endl;
  return 0;
}
