#include <bits/stdc++.h>
using namespace std;
int a[1000000];
int b[1000000];
vector<pair<int, int> > nei[2000000];
bool used[2000000];
int last[2000000];
bool used_edge[1000000];
vector<int> ans;
stack<int> s;
int absol(int x) { return max(x, -x); }
void DFS(int node) {
  for (; last[node] < nei[node].size(); last[node]++) {
    if (used[absol(nei[node][last[node]].second)] == 0) {
      int X = nei[node][last[node]].second;
      used[absol(nei[node][last[node]].second)] = true;
      DFS(nei[node][last[node]].first);
      ans.push_back(X);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int pow = 20; pow > -1; pow--) {
    for (int i = 0; i < n; i++) {
      a[i] %= (1 << pow);
      b[i] %= (1 << pow);
      used[i + 1] = false;
    }
    for (int i = 0; i < 2000000; i++) {
      nei[i].clear();
      last[i] = 0;
    }
    int start = 0;
    for (int i = 0; i < n; i++) {
      start = a[i];
      nei[a[i]].push_back(pair<int, int>(b[i], i + 1));
      nei[b[i]].push_back(pair<int, int>(a[i], -i - 1));
    }
    bool B = true;
    for (int i = 0; i < 2000000; i++) {
      if (nei[i].size() % 2 != 0) B = false;
    }
    if (B) {
      DFS(start);
      if (ans.size() == n) {
        cout << pow << endl;
        vector<int> ANS;
        for (auto A : ans) {
          if (A > 0)
            cout << 2 * A << " " << 2 * A - 1 << " ", ANS.push_back(2 * A),
                ANS.push_back(2 * A - 1);
          else
            cout << -2 * A - 1 << " " << -2 * A << " ",
                ANS.push_back(-2 * A - 1), ANS.push_back(-2 * A);
        }
        cout << endl;
        return 0;
      }
    }
    ans.clear();
  }
  return 0;
}
