#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n;
pair<int, int> A[100000];
struct Solution {
  long long solve() {
    sort(A, A + n);
    long long res = A[n - 1].first + 1, count = 1, p = res;
    for (int(i) = (n - 1); (i) >= (0); --(i)) {
      int k = A[i].first, a = A[i].second;
      while (count < a && p != k) {
        count *= 4, p--;
      }
      while (count < a) res++, count *= 4;
    }
    return res;
  }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int k, a;
  for (int(i) = (0); (i) < (n); ++(i)) cin >> k >> a, A[i] = {k, a};
  Solution test;
  cout << test.solve() << endl;
}
