#include <bits/stdc++.h>
using namespace std;
const long long MAX = 100010;
pair<long long, long long> A[MAX];
map<long long, long long> M;
long long n, res = 0;
long long ceil(long long n, long long k) {
  n = n + (k - (n % k)) % k;
  return (n / k);
}
void increase(long long p, long long q) {
  res = max(res, p);
  M[p] = max(M[p], q);
  if (M[p] >= 2) {
    increase(p + 1, ceil(M[p], 4));
  }
}
int main() {
  scanf("%lld", &n);
  for (long long i = 0; i < n; i++) {
    scanf("%lld %lld", &A[i].first, &A[i].second);
    res = max(res, A[i].first + 1);
  }
  sort(A, A + n);
  for (long long i = 0; i < n; i++) {
    increase(A[i].first, A[i].second);
  }
  printf("%lld\n", res);
}
