#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-9;
const double INF = 2e10;
const long long OO = (1LL << 60);
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  ios::sync_with_stdio(false), cin.tie(0);
  map<long long, long long> m;
  int n;
  long long k, a;
  cin >> n;
  long long mxK = 0;
  for (int i = 0; i < n; ++i) {
    cin >> k >> a;
    m[k] = a;
    mxK = max(mxK, k);
  }
  m[mxK + 1] = 1;
  long long ans = 0;
  for (auto it : m) {
    long long cur = it.first;
    long long count = it.second;
    while (count != 1) {
      long long newCount = (count + 3) / 4;
      count = newCount;
      cur++;
    }
    m[cur] = max(m[cur], 1LL);
    if (it.second == 1) {
      ans = it.first;
    }
  }
  cout << ans << endl;
  return 0;
}
