#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, -1, 0};
int dy[] = {1, 0, 0, -1};
long long pw(long long b, long long p) {
  if (!p) return 1;
  long long sq = pw(b, p / 2);
  sq *= sq;
  if (p % 2) sq *= b;
  return sq;
}
const int N = (2 * 1e5) + 10, M = N * 2;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int res = 0;
  for (int i = 0; i < n; i++) {
    int k, cnt;
    cin >> k >> cnt;
    int tmp = 0, need = 0;
    while (cnt > tmp) {
      if (!tmp)
        tmp += 4;
      else
        tmp *= 4;
      need++;
    }
    res = max(res, need + k);
  }
  cout << res;
  return 0;
}
