#include <bits/stdc++.h>
using namespace std;
int pp[] = {1,   2,   4,    8,    16,   32,   64,    128,
            256, 512, 1024, 2048, 4096, 8192, 16384, 32768};
struct aa {
  int a, k;
} ss[100005];
int f(aa a, aa b) { return a.k < b.k; }
int main() {
  int n, k;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> ss[i].k >> ss[i].a;
  sort(ss, ss + n, f);
  for (int i = 0; i < n - 1; i++) {
    k = ss[i + 1].k - ss[i].k;
    if (k <= 14)
      ss[i + 1].a +=
          max(int(ceil(ss[i].a / 1.0 / pp[k] / pp[k])) - ss[i + 1].a, 0);
  }
  double q = ss[n - 1].a;
  k = ss[n - 1].k;
  while (q > 1) {
    q = ceil(q / 4), k++;
  }
  cout << max(ss[n - 1].k + 1, k);
}
