#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
vector<int> pile[3], input;
int id[maxn];
bool mcmp(int a, int b) { return id[a] < id[b]; }
int main() {
  int n;
  cin >> n;
  n *= 2;
  for (int i = 0; i < (n); ++i) {
    int x;
    cin >> x;
    input.push_back(i);
    id[i] = x;
  }
  sort(input.begin(), input.end(), mcmp);
  for (int i = 0; i < (n); ++i) {
    int cur = id[input[i]], f = 1;
    if (pile[1].size() > pile[2].size()) f = 2;
    if (pile[f].size() && cur == id[pile[f].back()]) {
      pile[0].push_back(input[i]);
    } else {
      pile[f].push_back(input[i]);
    }
  }
  cout << pile[1].size() * pile[2].size() << endl;
  int left1 = n / 2 - pile[1].size(), left2 = n / 2 - pile[2].size();
  for (int i = 0; i < (pile[0].size()); ++i) {
    if (left1) {
      left1--;
      pile[1].push_back(pile[0][i]);
    } else if (left2) {
      left2--;
      pile[2].push_back(pile[0][i]);
    }
  }
  for (int i = 0; i < (pile[1].size()); ++i) {
    id[pile[1][i]] = 1;
  }
  for (int i = 0; i < (pile[2].size()); ++i) {
    id[pile[2][i]] = 2;
  }
  for (int i = 0; i < (n); ++i) printf("%d%c", id[i], i == n - 1 ? '\n' : ' ');
  return 0;
}
