#include <bits/stdc++.h>
int main() {
  int p, n, i;
  int k, a;
  while (scanf("%d", &n) != EOF) {
    p = 0;
    while (n--) {
      scanf("%d %d", &k, &a);
      if (a == 1) {
        k++;
        p = (p) > (k) ? (p) : (k);
      } else {
        while (a && a != 1) {
          if (a % 4 == 0)
            a /= 4;
          else
            a = a / 4 + 1;
          k++;
        }
        p = (p) > (k) ? (p) : (k);
      }
    }
    printf("%d\n", p);
  }
  return 0;
}
