#include <bits/stdc++.h>
using namespace std;
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
void Solve() {
  long long n;
  cin >> n;
  n *= 2;
  vector<pair<long long, long long> > a;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a.push_back(make_pair(x, i));
  }
  sort(a.begin(), a.end());
  bool isChecked[n + 1];
  long long ans[n + 1];
  for (long long i = 0; i <= n; i++) {
    isChecked[i] = false;
    ans[i] = -1;
  }
  long long cnt = 0, pos = 0;
  for (long long i = 0; i < n; i++) {
    cnt++;
    if (i != 0 && a[i].first != a[i - 1].first) {
      cnt = 1;
    }
    if (cnt <= 2) {
      ans[a[i].second] = pos;
      pos = 1 - pos;
      isChecked[a[i].second] = true;
    }
  }
  for (long long i = 0; i < n; i++) {
    if (!isChecked[a[i].second]) {
      ans[a[i].second] = pos;
      pos = 1 - pos;
    }
  }
  long long distinct = 0;
  set<long long> s1, s2;
  for (long long i = 0; i < n; i++) {
    if (ans[a[i].second] == 0) {
      s1.insert(a[i].first);
    } else {
      s2.insert(a[i].first);
    }
  }
  long long x = s1.size(), y = s2.size();
  distinct = x * y;
  cout << distinct << "\n";
  for (long long i = 0; i < n; i++) {
    cout << ans[i] + 1 << " ";
  }
  cout << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    Solve();
  }
}
