#include <bits/stdc++.h>
using namespace std;
long long log2(long long k) {
  long long p = 1;
  long ans = 0;
  while (p < k) {
    p *= 2;
    ans++;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  vector<pair<long long, long long> > sizes(n, pair<int, int>());
  for (int i = 0; i < n; i++) cin >> sizes[i].first >> sizes[i].second;
  sort(sizes.begin(), sizes.end());
  for (int i = 0; i < n - 1; i++) {
    long long extra = 0;
    long long t =
        sizes[i].second - pow(2, (2 * (sizes[i + 1].first - sizes[i].first))) *
                              sizes[i + 1].second;
    if (t > 0)
      extra = ceil((double)t /
                   (pow(2, (2 * (sizes[i + 1].first - sizes[i].first)))));
    sizes[i + 1].second += extra;
  }
  long long soln;
  for (long long i = sizes[n - 1].first + 1;; i++) {
    if (sizes[n - 1].second <= pow(2, (2 * (i - sizes[n - 1].first)))) {
      soln = i;
      break;
    }
  }
  cout << soln << endl;
  return 0;
}
