#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
int cnt[N], p[N];
void read() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> p[i] >> cnt[i];
  }
}
int f(int cnt) {
  int k = 1;
  for (int st = 4; st < cnt; st *= 4, ++k)
    ;
  return k;
}
int sol() {
  int res = 0;
  for (int i = 0; i < n; ++i) {
    res = max(res, f(cnt[i]) + p[i]);
  }
  return res;
}
int main() {
  read();
  cout << sol() << "\n";
  return 0;
}
