#include <bits/stdc++.h>
using namespace std;
long long changeTo(long long ci, int ni, long long cur) {
  long long diff = ci - ni;
  while (diff > 0) {
    cur *= 4;
    if (cur >= numeric_limits<long long>::max() / 1024)
      return numeric_limits<long long>::max() / 1024;
    diff--;
  }
  return cur;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> l(n + 1);
  vector<int> q(n + 1);
  for (int i = 0; i < n; i++) scanf("%d%d", &l[i], &q[i]);
  {
    vector<pair<int, int> > temp;
    for (int i = 0; i < n; i++) temp.push_back(make_pair(l[i], q[i]));
    sort(temp.begin(), temp.end());
    for (int i = 0; i < n; i++) l[i] = temp[i].first, q[i] = temp[i].second;
  }
  long long ans = 1LL << 32, sub = (1LL << 32), temp;
  while (sub) {
    temp = ans - sub;
    sub >>= 1;
    if (temp <= 0) continue;
    bool ok = true;
    long long cur = 1, ind = temp;
    for (int i = n - 1; i >= 0; i--) {
      if (ind <= l[i]) {
        ok = false;
        break;
      }
      cur = changeTo(ind, l[i], cur);
      ind = l[i];
      if (cur < q[i]) {
        ok = false;
        break;
      }
    }
    if (ok) ans = temp;
  }
  cout << ans;
  printf("\n");
}
