#include <bits/stdc++.h>
const long long MOD = (long long)1e9 + 7;
using namespace std;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) return 1LL * power(a, b / 2) * power(a, b / 2);
  b--;
  return 1LL * power(a, b) * a;
}
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }
int main() {
  int n;
  scanf("%d", &n);
  int k, a;
  map<int, int> cnt;
  int mx = -1;
  int ans = -1;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &k, &a);
    cnt[k] = a;
    mx = max(mx, k);
    int m = k, s = 1;
    while (s < a) {
      s *= 4;
      m++;
    }
    ans = max(ans, m);
  }
  if (ans == mx) ans++;
  cout << ans << "\n";
}
