#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int N = (int)1e6 + 7, mod = 1000000007, M = 2e9;
int n, c, t;
pair<int, int> x[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%d%d", &x[i].first, &x[i].second);
  sort(x, x + n);
  for (int i = 0; i < n; i++) {
    while (t > 1 && c < x[i].first) t = (t + 3) / 4, c++;
    t = max(t, x[i].second);
    c = x[i].first;
  }
  while (t > 1) t = (t + 3) / 4, c++;
  cout << max(c, x[n - 1].first + 1);
  return 0;
}
