#include <bits/stdc++.h>
using namespace std;
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
int main() {
  file();
  fast();
  int n;
  cin >> n;
  vector<pair<int, int> > v1(n);
  for (auto& it : v1) cin >> it.first >> it.second;
  sort(v1.begin(), v1.end());
  int mod = 0;
  for (int i = 0; i < n - 1; i++) {
    int tmp = 0;
    while (v1[i].first != v1[i + 1].first && v1[i].second) {
      if (v1[i].second % 4) tmp = 1;
      v1[i].second /= 4, v1[i].first++;
    }
    if (v1[i + 1].second < v1[i].second)
      v1[i + 1].second = v1[i].second, mod = 0;
    else if (v1[i + 1].second > v1[i].second)
      mod = 0, tmp = 0;
    mod = max(mod, tmp);
  }
  do {
    if (v1.back().second % 4) mod = 1;
    v1.back().second /= 4;
    v1.back().first++;
  } while (v1.back().second > 1);
  if (v1.back().second == 0) mod = 0;
  cout << v1.back().first + mod << "\n";
  return 0;
}
