#include <bits/stdc++.h>
using namespace std;
int n, m;
struct Node {
  int k, a;
} node[100005];
bool _cmp(struct Node a, struct Node b) { return a.k < b.k; }
int main() {
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> node[i].k >> node[i].a;
  sort(node, node + n, _cmp);
  int k0 = node[0].k, a0 = node[0].a;
  for (int i = 1; i < n; i++) {
    while (k0 < node[i].k) {
      k0++;
      a0 = (a0 + 3) / 4;
    }
    a0 = max(a0, node[i].a);
  }
  if (a0 == 0)
    cout << 0 << endl;
  else {
    while (a0 > 1) {
      k0++;
      a0 = (a0 + 3) / 4;
    }
  }
  if (k0 == node[n - 1].k) k0++;
  cout << k0 << endl;
  return 0;
}
