#include <bits/stdc++.h>
const int kMaxN = 100005;
int N, a[kMaxN], k[kMaxN];
bool ok(long long lat) {
  for (int i = 1; i <= N; ++i)
    if (lat <= k[i] || (2 * (lat - k[i])) < (double)log2(a[i])) return 0;
  return 1;
}
long long binary_search() {
  long long pas = (1LL << 60), i = 0;
  for (i = 0; pas; pas >>= 1)
    if (!ok(i + pas)) i += pas;
  return i + 1;
}
int main() {
  assert(scanf("%d", &N) == 1);
  for (int i = 1; i <= N; ++i) assert(scanf("%d%d", &k[i], &a[i]) == 2);
  printf("%I64d\n", binary_search());
  return 0;
}
