#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
pair<int, int> ar[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &ar[i].first, &ar[i].second);
  }
  sort(ar, ar + n);
  for (int i = 1; i < n; ++i) {
    int sz = ar[i - 1].first;
    while (ar[i - 1].second > 1 && sz < ar[i].first) {
      ++sz;
      ar[i - 1].second = (ar[i - 1].second + 3) / 4;
    }
    ar[i].second = max(ar[i].second, ar[i - 1].second);
  }
  do {
    ++ar[n - 1].first;
    ar[n - 1].second = (ar[n - 1].second + 3) / 4;
  } while (ar[n - 1].second > 1);
  printf("%d\n", ar[n - 1].first);
  return 0;
}
