#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10;
const long long inf = -1e18;
const long long INF = 1e18;
const long long mod = 1e9 + 7;
const double PI = acos(-1);
long long n, p, c, ans, k[N], a[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> k[i] >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    p = 1, c = 0;
    while (p < a[i]) {
      p = p * 4;
      c++;
    }
    ans = max(ans, c + k[i] + (a[i] == 1));
  }
  cout << ans;
}
