#include <bits/stdc++.h>
const long long INF = 1e18L + 1;
const int IINF = 1e9 + 1;
using namespace std;
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << '=' << h << ',';
  _dbg(sdbg + 1, a...);
}
const long long N = 100;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> res(2 * n);
  map<long long, vector<long long> > pos;
  for (long long i = (long long)0; i < (long long)2 * n; i++) {
    long long x;
    cin >> x;
    pos[x].push_back(i);
  }
  vector<long long> useful, useless;
  long long cnt_both_sides = 0;
  for (auto &p : pos) {
    if ((int)((p.second).size()) >= 2) {
      cnt_both_sides++;
      res[p.second[0]] = 0;
      res[p.second[1]] = 1;
      useless.insert(useless.end(), p.second.begin() + 2, p.second.end());
    } else {
      useful.push_back(p.second[0]);
    }
  }
  cout << (cnt_both_sides + ((int)((useful).size()) + 1) / 2) *
              (cnt_both_sides + (int)((useful).size()) / 2)
       << "\n";
  vector<long long> remain = useful;
  remain.insert(remain.end(), (useless).begin(), (useless).end());
  for (long long i = (long long)0; i < (long long)(int)((remain).size()); i++) {
    res[remain[i]] = (i & 1);
  }
  for (long long i = (long long)0; i < (long long)2 * n; i++) {
    cout << res[i] + 1 << " \n"[i == 2 * n - 1];
  }
  return 0;
}
