#include <bits/stdc++.h>
using namespace std;
long long ans, n, a, k;
int main() {
  ans = 0;
  scanf("%d", &n);
  while (n--) {
    scanf("%d %d", &k, &a);
    ans = max(ans, k + 1);
    while (a != 1) {
      a = (a + 3) / 4;
      k++;
      ans = max(ans, k);
    }
  }
  printf("%d", ans);
  return 0;
}
