#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
pair<int, int> sq[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &sq[i].first, &sq[i].second);
  }
  sort(sq, sq + n);
  reverse(sq, sq + n);
  int max = sq[0].first + 1;
  for (int i = 0; i < n; ++i) {
    int lg = 0;
    while ((1LL << (lg + lg)) < sq[i].second) ++lg;
    int need = lg + sq[i].first - max;
    if (need > 0) max += need;
  }
  printf("%d\n", max);
  return 0;
}
