#include <bits/stdc++.h>
using namespace std;
const int MAXN = (1 << 20) + 5;
bitset<MAXN> used;
vector<pair<int, int>> adj[MAXN];
int a[MAXN];
int n;
vector<int> ans;
void dfs(int x) {
  while (!adj[x].empty()) {
    if (used[adj[x].back().second / 2]) {
      adj[x].pop_back();
      continue;
    }
    auto p = adj[x].back();
    adj[x].pop_back();
    used[p.second / 2] = true;
    dfs(p.first);
    ans.push_back(p.second);
  }
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < 2 * n; i++) cin >> a[i];
  for (int k = 20; k >= 0; k--) {
    for (int i = 0; i < n; i++) {
      used[i] = false;
    }
    for (int i = 0; i < 2 * n; i++) a[i] = a[i] % (1 << k);
    for (int i = 0; i < (1 << k); i++) adj[i].clear();
    for (int i = 0; i < n; i++) {
      adj[a[2 * i]].push_back(make_pair(a[2 * i + 1], 2 * i));
      adj[a[2 * i + 1]].push_back(make_pair(a[2 * i], 2 * i + 1));
    }
    bool impossible = false;
    for (int i = 0; i < (1 << k); i++) {
      if (adj[i].size() % 2) {
        impossible = true;
      }
    }
    if (impossible) continue;
    dfs(a[0]);
    if (ans.size() == n) {
      cout << k << "\n";
      for (int i = n - 1; i >= 0; i--) {
        cout << 1 + ans[i] << " " << 1 + (ans[i] ^ 1) << " ";
      }
      return 0;
    }
    ans.clear();
  }
}
