#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e6 + 8;
const long long sz = 1e5 + 5;
void f_io() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
}
int32_t main() {
  f_io();
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    std::vector<pair<long long, long long> > v(n);
    for (long long i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
    long long ans = 0;
    for (long long i = 0; i < n; i++) {
      if (v[i].second == 1) ans = max(ans, v[i].first + 1);
      while (v[i].second > 1) {
        v[i].second = (v[i].second + 3) / 4;
        v[i].first++;
        ans = max(ans, v[i].first);
      }
    }
    cout << ans << "\n";
  }
}
