#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<long long, long long> > v(n);
  for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
  sort(v.begin(), v.end());
  long long p = v[n - 1].first + 1;
  for (int i = 0; i < n; i++) {
    long long p2 = v[i].first;
    long long sz = 1;
    while (sz < v[i].second) {
      sz *= 4;
      p2++;
    }
    p = max(p, p2);
  }
  cout << p << endl;
}
