#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 5;
int log_four(int x) {
  int j = 0, i;
  for (i = 4; i <= x; i = i * 4)
    if (i == x) break;
  if (i <= x) j--;
  while (x != 0) {
    j++;
    x = x / 4;
  }
  return j;
}
int main() {
  int i, j, n, m, k;
  cin >> n;
  k = 0;
  for (i = 0; i < n; i++) {
    cin >> j >> m;
    k = max(k, j + log_four(m));
  }
  cout << k << '\n';
}
