#include <bits/stdc++.h>
using namespace std;
struct node {
  long long a, num;
} s[1000050];
bool cmp(node a, node b) { return a.a < b.a; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%I64d%I64d", &s[i].a, &s[i].num);
  }
  sort(s, s + n, cmp);
  for (int i = 1; i < n; ++i) {
    long long now = s[i - 1].num;
    for (int j = s[i - 1].a; j < s[i].a; ++j) {
      now = (now + 3) / 4;
      if (now == 1) break;
    }
    if (now > s[i].num) s[i].num += now - s[i].num;
  }
  long long ans = s[n - 1].a + 1;
  long long now = (s[n - 1].num + 3) / 4;
  while (now != 1) {
    ans++;
    now = (now + 3) / 4;
  }
  printf("%I64d\n", ans);
}
