#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > vec;
bool check(long long p) {
  for (long long i = ((long long)vec.size()) - 1; i >= 0; i--) {
    long long temp = vec[i].second, tp = vec[i].first;
    if (p == tp && temp == 1) return false;
    while (tp < p && temp > 1) {
      temp = (temp / 4) + bool(temp % 4);
      tp++;
    }
    if (temp <= 1) continue;
    return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  for (__typeof(n) i = 0; i < (n); i++) {
    long long k, a;
    cin >> k >> a;
    vec.push_back(make_pair(k, a));
  }
  sort(vec.begin(), vec.end());
  long long age = 0, p = 0;
  long long ans = vec.back().first;
  for (;; ans++) {
    if (check(ans)) break;
  }
  cout << ans << endl;
  return 0;
}
