#include <bits/stdc++.h>
using namespace std;
void RD(int &x) { scanf("%d", &x); }
void RD(double &x) { scanf("%lf", &x); }
void RD(int &x, int &y) { scanf("%d%d", &x, &y); }
void RD(double &x, double &y) { scanf("%lf%lf", &x, &y); }
void RD(int &x, int &y, int &z) { scanf("%d%d%d", &x, &y, &z); }
void RD(double &x, double &y, double &z) { scanf("%lf%lf%lf", &x, &y, &z); }
void RD(char *s) { scanf("%s", s); }
void PR(int x) { printf("%d\n", x); }
void PR(int x, int y) { printf("%d %d\n", x, y); }
void PR(double x) { printf("%.6lf\n", x); }
void PR(char x) { printf("%c\n", x); }
void PR(char x[]) { printf("%s\n", x); }
void PRI(char x[]) { printf("%s", x); }
int main() {
  int n;
  RD(n);
  n = n * 2;
  int nums[1000];
  int i, j;
  for (i = 0; i < (n); ++i) {
    RD(nums[i]);
  }
  int ha[1000];
  memset((ha), 0, sizeof((ha)));
  int group[1000];
  memset((group), 0, sizeof((group)));
  int cnt[1000];
  memset((cnt), 0, sizeof((cnt)));
  for (i = 0; i < (n); ++i) cnt[nums[i]]++;
  int top = 0;
  for (i = 0; i < (n); ++i) {
    if (cnt[nums[i]] >= 2) {
      if (ha[nums[i]] < 2) {
        ha[nums[i]]++;
        group[i] = ha[nums[i]];
      }
    } else {
      group[i] = (top % 2) + 1;
      top++;
    }
  }
  for (i = 0; i < (n); ++i) {
    if (group[i] == 0) {
      group[i] = (top % 2) + 1;
      top++;
    }
  }
  memset((ha), 0, sizeof((ha)));
  memset((cnt), 0, sizeof((cnt)));
  for (i = 0; i < (n); ++i) {
    if (group[i] == 1)
      ha[nums[i]] = 1;
    else
      cnt[nums[i]] = 1;
  }
  int a = 0, b = 0;
  for (i = (10); i <= (99); ++i) {
    if (ha[i] == 1) a++;
    if (cnt[i] == 1) b++;
  }
  PR(a * b);
  for (i = 0; i < (n); ++i) printf("%d ", group[i]);
  PR("");
  return 0;
}
