#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 1000 + 10;
pair<int, int> all[MAXN];
int main() {
  int k, a, n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> k >> a;
    all[i].first = k;
    all[i].second = a;
  }
  sort(all, all + n);
  int now = all[n - 1].first + 1;
  for (int i = n - 1; i >= 0; i--) {
    int x = ceil(log2(all[i].second));
    while (2 * (now - all[i].first) < x) {
      now++;
    }
  }
  cout << now << endl;
  return 0;
}
