#include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
pair<long long, long long> a[MAX];
int main() {
  int N, i;
  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a, a + N);
  long long ant = 0, h = 0;
  int aux;
  for (i = 0; i < N; i++) {
    aux = a[i].first - h;
    for (int j = 0; j < aux && ant > 1; j++) ant = (ant + 3) / 4;
    if (ant < a[i].second) ant = a[i].second;
    h = a[i].first;
  }
  i = 1;
  aux = 4;
  for (; aux < ant; aux *= 4, i++)
    ;
  cout << h + i << endl;
  return 0;
}
