#include <bits/stdc++.h>
using namespace std;
int main() {
  for (int N; cin >> N;) {
    vector<pair<int, int>> ka;
    for (int i = 0; i < N; ++i) {
      int k, a;
      cin >> k >> a;
      ka.emplace_back(k, a);
    }
    sort(ka.begin(), ka.end());
    for (int i = 0; i + 1 < ka.size(); ++i) {
      int& k0 = ka[i].first;
      int& a0 = ka[i].second;
      int& k1 = ka[i + 1].first;
      int& a1 = ka[i + 1].second;
      long long n = 1;
      for (int i = 0; i < k1 - k0 && ((a0 + (n - 1)) / n) > 1; ++i) n *= 4;
      int b1 = (a0 + (n - 1)) / n;
      a1 = max(a1, b1);
    }
    int k = ka.back().first;
    int a = ka.back().second;
    if (a == 1)
      cout << k + 1 << endl;
    else {
      while (a != 1) {
        k += 1;
        a = (a + 3) / 4;
      }
      cout << k << endl;
    }
  }
}
