#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<int, int> a[n];
  int ma = -1;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    a[i] = {x, y};
    ma = max(x, ma);
  }
  int ans = a[n - 1].first, ch = 0;
  int l = 0, r = 1e9 + 33;
  while (l < r) {
    int m = (l + r) / 2;
    ans = m;
    ch = 0;
    for (int i = 0; i < n; i++) {
      int box = a[i].second, ct = 0, box1;
      box1 = box;
      int ko = 1;
      while (ko < box) {
        ko *= 4;
        ct++;
      }
      if (ans - a[i].first < ct) {
        ch = 1;
        break;
      }
    }
    if (ch == 0) {
      r = m;
    } else {
      l = m + 1;
    }
  }
  if (ma == l) l++;
  cout << l;
  return 0;
}
