#include <bits/stdc++.h>
using namespace std;
int seq[100010], a[100010], b[100010];
int n;
const int MAX = (1 << 30);
int cmp(const int &i, const int &j) { return a[i] < a[j]; }
int valid(int x) {
  int i;
  for (i = n - 1; i >= 0 && x - a[seq[i]] <= 15; --i)
    if (b[seq[i]] > (1 << ((x - a[seq[i]]) * 2))) return 0;
  return 1;
}
void conduct() {
  int i, lst, mst, mid;
  for (i = 0; i < n; ++i) scanf("%d%d", &a[i], &b[i]);
  for (i = 0; i < n; ++i) seq[i] = i;
  sort(seq, seq + n, cmp);
  lst = a[seq[n - 1]] + 1;
  mst = MAX;
  while (lst < mst) {
    mid = (lst + mst) / 2;
    if (valid(mid))
      mst = mid;
    else
      lst = mid + 1;
  }
  printf("%d\n", lst);
}
int main() {
  while (scanf("%d", &n) != EOF) conduct();
  return 0;
}
