#include <bits/stdc++.h>
using namespace std;
const int NMax = 100010;
const int INF = int(1e9);
const int cntTree = 262145;
const double eps = 1e-9;
const double PI = 3.141592653589793238462;
const int MOD = int(1e9 + 7);
int n;
int k[NMax], a[NMax];
int f(int y, int k) {
  if (y == 1) y++;
  int s = -1;
  for (int i = 1; i < y; i *= 4) s++;
  s += k + 1;
  return s;
}
int main() {
  scanf("%i", &n);
  for (int i = 1; i <= n; i++) scanf("%i%i", &k[i], &a[i]);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int tmp = f(a[i], k[i]);
    ans = ((ans) > (tmp) ? (ans) : (tmp));
  }
  cout << ans << endl;
  return 0;
}
