#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > box;
int main() {
  int n, k, a, x;
  cin >> n;
  for (int i = int(1); i <= int(n); i++)
    cin >> k >> a, box.push_back(make_pair(k, a));
  sort(box.begin(), box.end());
  for (int i = int(1); i <= int(n - 1); i++) {
    x = box[i - 1].second;
    for (int j = int(1); j <= int(box[i].first - box[i - 1].first); j++) {
      if (x <= box[i].second) break;
      x = x % 4 ? x / 4 + 1 : x / 4;
    }
    box[i].second = max(x, box[i].second);
  }
  k = box[n - 1].first, a = box[n - 1].second, k++,
  a = a % 4 ? a / 4 + 1 : a / 4;
  for (; a > 1; k++, a = a % 4 ? a / 4 + 1 : a / 4)
    ;
  cout << k << endl;
  return 0;
}
