#include <bits/stdc++.h>
using namespace std;
int n;
struct node {
  int a, k;
  bool operator<(const node& e) const { return k < e.k; }
} a[300100];
int main() {
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++) scanf("%d %d", &a[i].k, &a[i].a);
    sort(a, a + n);
    int ans = a[0].a;
    for (int i = 1; i < n; i++) {
      int u = 0;
      while (ans != 1 && u + a[i - 1].k < a[i].k) {
        u++;
        ans = (ans + 3) / 4;
      }
      ans = max(ans, a[i].a);
    }
    if (ans == 1)
      printf("%d\n", a[n - 1].k + 1);
    else {
      int p = a[n - 1].k;
      while (ans != 1) {
        p++;
        ans = (ans + 3) / 4;
      }
      printf("%d\n", p);
    }
  }
  return 0;
}
