#include <bits/stdc++.h>
using namespace std;
int log2SquareRoot(int num) { return (int)ceil(log2((int)ceil(sqrt(num)))); }
int main(int argc, const char *argv[]) {
  int n, k, a, mx = 0;
  cin >> n;
  while (n--) {
    cin >> k >> a;
    mx = max(k + log2SquareRoot(a) + (a == 1 ? 1 : 0), mx);
  }
  cout << mx;
  return 0;
}
