#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
const int INF = (int)1E9 + 5;
const double EPS = 1E-11;
const long long MOD = (long long)1E9 + 7;
int ntest = 0, test = 0;
inline void init();
inline void run();
inline void stop() { ntest = test - 1; }
pair<int, int> group[(int)1e5 + 5];
int main() {
  init();
  while (++test <= ntest) {
    run();
  }
  return 0;
}
inline void init() { ntest = 1; }
inline void run() {
  int n, ki, ai;
  cin >> n;
  for (int i = 0; i < (n); i++) {
    scanf("%d %d", &ki, &ai);
    group[i] = make_pair(ki, ai);
  }
  sort(group, group + n);
  long long total = 0;
  int size = 0;
  for (int i = 0; i < (n); i++) {
    int curSize = group[i].first;
    int box = group[i].second;
    int more = (int)ceil(total / powl(4, curSize - size));
    total = max(box, more);
    size = curSize;
  }
  if (total == 1)
    size++;
  else {
    while (total > 1) {
      total = (int)ceil((double)total / 4);
      size++;
    }
  }
  cout << size;
}
