#include <bits/stdc++.h>
using namespace std;
vector<string> vec_splitter(string s) {
  for (char &c : s) c = c == ',' ? ' ' : c;
  stringstream ss;
  ss << s;
  vector<string> res;
  for (string z; ss >> z; res.push_back(z))
    ;
  return res;
}
void debug_out(vector<string> args, int idx) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, Head H, Tail... T) {
  if (idx > 0) cerr << ", ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, T...);
}
void localTest() {}
const long long N = (1 << 20) + 5;
long long A[N], L[N], R[N], ed[N], n, vis[N];
vector<long long> V[N];
void eulerCircuit(long long x, vector<long long> &path) {
  while (ed[x] < V[x].size()) {
    long long idx = V[x][ed[x]];
    if (vis[idx]) {
      ed[x]++;
    } else {
      vis[idx] = 1;
      if (L[idx] == x) {
        eulerCircuit(R[idx], path);
        path.push_back(2 * idx + 2);
        path.push_back(2 * idx + 1);
      } else {
        eulerCircuit(L[idx], path);
        path.push_back(2 * idx + 1);
        path.push_back(2 * idx + 2);
      }
    }
  }
  return;
}
void solve(long long x, vector<long long> &path) {
  long long mask = (1LL << x) - 1;
  for (long long i = 0; i < n; ++i) {
    vis[i] = 0;
    L[i] = A[2 * i] & mask;
    R[i] = A[2 * i + 1] & mask;
    V[L[i]].push_back(i);
    V[R[i]].push_back(i);
  }
  bool fl = true;
  for (long long i = 0; i <= mask; ++i) {
    if (V[i].size() & 1) {
      fl = false;
      break;
    }
  }
  if (fl) {
    path.clear();
    eulerCircuit(L[0], path);
  }
  if (path.size() != 2 * n) {
    fl = false;
    path = {};
  }
  for (long long i = 0; i <= mask; ++i) {
    V[i].clear();
    ed[i] = 0;
  }
  return;
}
int main() {
  localTest();
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < 2 * n; ++i) {
    cin >> A[i];
  }
  vector<long long> path;
  long long ans = 1;
  for (long long b = 20; b >= 0; --b) {
    path.clear();
    solve(b, path);
    if (path.size() == 2 * n) {
      ans = b;
      break;
    }
  }
  cout << ans << "\n";
  for (auto u : path) cout << u << " ";
  cout << "\n";
  return 0;
}
