#include <bits/stdc++.h>
using namespace std;
int n, k, a;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> k >> a;
    if (1 == a) k++;
    while (a != 1) {
      if (a % 4 != 0)
        a = a / 4 + 1;
      else
        a /= 4;
      k++;
    }
    ans = k > ans ? k : ans;
  }
  cout << ans << endl;
  return 0;
}
