#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int main() {
  int n = 0;
  long long int cur_k, cur_a = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int k, a;
    scanf("%d %d", &k, &a);
    v.push_back(make_pair(k, a));
  }
  sort(v.begin(), v.end());
  int i = 0;
  for (cur_k = 0; i < n; ++cur_k) {
    long long int new_a = cur_a / 4;
    if (cur_a % 4 != 0) new_a++;
    if (cur_k == v[i].first) {
      long long int second = v[i].second;
      new_a = max(new_a, second);
      ++i;
    }
    cur_a = new_a;
    if (cur_a <= 1 && i < n) cur_k = max(v[i].first - 1, 0);
  }
  cur_k--;
  while (cur_a > 1) {
    ++cur_k;
    long long int new_a = cur_a / 4;
    if (cur_a % 4 != 0) new_a++;
    cur_a = new_a;
  }
  if (cur_k == v[n - 1].first) cur_k++;
  cout << cur_k;
  return 0;
}
