#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > a;
  for (int i = 0; i < n; i++) {
    int ai, ki;
    cin >> ki >> ai;
    a.push_back(pair<int, int>(ki, ai));
  }
  sort((a).begin(), (a).end());
  long long res = a[0].second;
  for (int i = 1; i < (int)(a).size(); i++) {
    int dif = a[i].first - a[i - 1].first;
    while (dif-- && res > 1) res = (res + 3) / 4;
    if (res < a[i].second) res = a[i].second;
  }
  res = (res + 3) / 4;
  int kres = a[(int)(a).size() - 1].first + 1;
  while (res > 1) {
    kres++;
    res = (res + 3) / 4;
  }
  cout << kres;
  return 0;
}
