#include <bits/stdc++.h>
using namespace std;
struct po {
  int k, n;
} a[1050001];
int max(int x, int y) { return x > y ? x : y; }
bool cmp(po x, po y) { return x.k < y.k; }
int f(int nn, int m) {
  while (m--) {
    nn = (nn + 3) / 4;
    if (nn == 1) break;
  }
  return nn;
}
int main() {
  int n, m;
  while (~scanf("%d", &n)) {
    int i;
    for (i = 0; i < n; i++) {
      scanf("%d%d", &a[i].k, &a[i].n);
    }
    sort(a, a + n, cmp);
    int pre = -100, num = 0;
    for (i = 0; i < n; i++) {
      if (num) {
        num = max(f(num, a[i].k - pre), a[i].n);
      } else
        num = a[i].n;
      pre = a[i].k;
    }
    if (num == 1) pre++;
    while (num >= 2) {
      pre++;
      num = (num + 3) / 4;
    }
    printf("%d\n", pre);
  }
  return 0;
}
