#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const long long LLINF = 9223372036854775807LL;
const int maxn = 100010;
pair<int, int> a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d%d", &a[i].first, &a[i].second);
  sort(a, a + n);
  int cnt = 0;
  int pw = 0;
  for (int i = 0; i < n; ++i) {
    while (cnt > 1 && pw < a[i].first) cnt = (cnt + 3) / 4, pw++;
    pw = a[i].first;
    cnt = max(cnt, a[i].second);
  }
  while (cnt > 1) {
    cnt = (cnt + 3) / 4;
    pw++;
  }
  if (pw == a[n - 1].first) ++pw;
  printf("%d\n", pw);
  return 0;
}
