#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 100100;
pair<int, int> pt[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int s, t;
    scanf("%d%d", &s, &t);
    pt[i] = make_pair(s, t);
  }
  sort(pt, pt + n);
  int tt = pt[0].second;
  for (int i = 1; i < n; i++) {
    int now = pt[i].first;
    int pre = pt[i - 1].first;
    int da = now - pre;
    if (da >= 15 && tt > 0) {
      tt = max(pt[i].second, 1);
    } else {
      int pp = 1;
      while (da) {
        pp *= 4;
        da--;
      }
      tt = max(pt[i].second, tt / pp + (tt % pp == 0 ? 0 : 1));
    }
  }
  int ans = pt[n - 1].first;
  int gg = 1;
  if (tt == 1)
    ans++;
  else
    while (tt > gg) {
      gg *= 4;
      ans++;
    }
  printf("%d\n", ans);
  return 0;
}
