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