#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > boxes;
bool solve(int p) {
  for (int i = 0; i < boxes.size(); ++i) {
    int e = p - boxes[i].first;
    if (2 * e < boxes[i].second) return false;
  }
  return true;
}
int find_exp(int a) {
  int e = 0;
  while ((1 << e) < a) e++;
  return e;
}
int main() {
  int n;
  while (cin >> n) {
    boxes.clear();
    int low = 0;
    int high = 1000001000;
    for (int i = 0; i < n; ++i) {
      int k, a;
      cin >> k >> a;
      boxes.push_back(make_pair(k, find_exp(a)));
      low = max(low, k + 1);
    }
    sort(boxes.begin(), boxes.end());
    while (low != high) {
      int p = (low + high) / 2;
      if (solve(p)) {
        high = p;
      } else {
        low = p + 1;
      }
    }
    assert(low == high);
    cout << high << endl;
  }
  return 0;
}
