#include <bits/stdc++.h>
using namespace std;
int n, kq;
pair<int, int> a[100010];
int main() {
  if (0) {
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  };
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].first, &a[i].second);
  sort(a + 1, a + n + 1);
  int dem = 0;
  for (int i = 1; i <= n; i++) {
    int x = dem;
    int y = a[i].first - a[i - 1].first;
    while (x > 1 && y-- > 0) x = (x - 1) / 4 + 1;
    dem = max(x, a[i].second);
  }
  int x = dem;
  kq = a[n].first + 1;
  while (x > 4) {
    x = (x - 1) / 4 + 1;
    kq++;
  }
  cout << kq;
  return 0;
}
