#include <bits/stdc++.h>
using namespace std;
int n, m;
int cal(int &b) {
  if (b % 4 == 0)
    b /= 4;
  else {
    b /= 4;
    b++;
  };
  return b;
}
int main() {
  scanf("%d", &n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (ans == a) ans++;
    if (b == 1) a++;
    while (b != 1) cal(b), a++;
    ans = max(ans, a);
  }
  printf("%d\n", ans);
}
