#include <bits/stdc++.h>
using namespace std;
pair<int, int> p[100005];
int n, maxcnt, rez;
long long acor, kcor;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> p[i].first >> p[i].second;
    maxcnt = max(maxcnt, p[i].second);
  }
  sort(p + 1, p + n + 1);
  rez = p[n].first + 1;
  acor = 4;
  kcor = rez - 1;
  for (int i = n; i; --i) {
    for (; kcor > p[i].first && acor < maxcnt; acor *= 4LL, --kcor)
      ;
    for (; acor < p[i].second; acor *= 4LL, ++rez)
      ;
  }
  cout << rez;
  return 0;
}
