#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int k, a;
} box;
int cmp(const void *a, const void *b) {
  box *aa = (box *)a;
  box *bb = (box *)b;
  return (((aa->k) > (bb->k)) ? 1 : -1);
}
int main() {
  int n;
  while (cin >> n) {
    box boxes[n];
    for (int i = 0; i < n; i++) cin >> boxes[i].k >> boxes[i].a;
    qsort(boxes, n, sizeof(boxes[0]), cmp);
    for (int i = 0; i < n - 1; i++) {
      if (boxes[i].k == boxes[i + 1].k) {
        boxes[i + 1].a += boxes[i].a;
      } else {
        int d = (int)pow(4.0, (double)(boxes[i + 1].k - boxes[i].k));
        boxes[i].a = (boxes[i].a + (d - 1)) / d;
        if (boxes[i + 1].a < boxes[i].a) boxes[i + 1].a = boxes[i].a;
      }
    }
    int p = boxes[n - 1].a;
    int op = boxes[n - 1].k + 1;
    while (p > 4) {
      p = (p + 3) / 4;
      op++;
    }
    cout << op << endl;
  }
  return 0;
}
