#include <bits/stdc++.h>
const int mo = 1000000007;
const int inf = 0x3f3f3f3f;
using namespace std;
struct node {
  long long k, s;
} box[100005];
bool cmp(const node &a, const node &b) { return a.k < b.k; }
int main() {
  int n, i;
  long long sum;
  cin >> n;
  for (i = 0; i < n; i++) cin >> box[i].k >> box[i].s;
  sort(box, box + n, cmp);
  long long ans = box[0].k;
  for (i = 0; i < n; i++) {
    long long t = box[i].k;
    sum = 1;
    while (t > box[i - 1].k) {
      t--;
      sum *= 4;
      if (sum * box[i].s >= box[i - 1].s) break;
    }
    if (sum * box[i].s < box[i - 1].s) {
      box[i - 1].s -= sum * box[i].s;
      box[i].s += box[i - 1].s / sum;
      if (box[i - 1].s % sum) box[i].s++;
    }
  }
  ans = box[n - 1].k;
  if (box[n - 1].s == 1) {
    cout << ans + 1 << endl;
    return 0;
  }
  double x = box[n - 1].s;
  while (x > 1) {
    ans++;
    x /= 4;
  }
  cout << ans << endl;
  return 0;
}
