#include <bits/stdc++.h>
using namespace std;
int A[15];
int calc(int te1, int te2) {
  if (te1 > 14) return 1;
  int te3 = te2 / A[te1];
  if (te2 % A[te1] != 0) te3++;
  return te3;
}
int main() {
  for (int i = 0; i < 15; i++) {
    long long te1 = (long long)pow(4, i);
    if (te1 <= 1000000000) A[i] = te1;
  }
  int N;
  cin >> N;
  vector<pair<int, int> > temp1(N);
  for (int i = 0; i < N; i++) scanf("%d %d", &temp1[i].first, &temp1[i].second);
  sort(temp1.begin(), temp1.end());
  for (int i = 1; i < N; i++) {
    temp1[i].second =
        max(temp1[i].second,
            calc(temp1[i].first - temp1[i - 1].first, temp1[i - 1].second));
  }
  int f1 = 0;
  int ans22 = 0;
  int te5 = temp1[N - 1].second;
  for (int i = 0; i < 14 && f1 == 0; i++) {
    if (A[i] <= te5 && A[i + 1] >= te5) {
      ans22 = i;
      f1 = 1;
    }
  }
  if (f1 == 1)
    cout << temp1[N - 1].first + ans22 + 1 << endl;
  else
    cout << temp1[N - 1].first + 14 + 1 << endl;
  return 0;
}
