#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
long long K[100009], A[100009];
pair<long long, long long> S[100009];
int main() {
  int n, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%I64d %I64d", &S[i].first, &S[i].second);
  }
  sort(S, S + n);
  for (i = 0; i < n; i++) {
    A[i] = S[i].second;
    K[i] = S[i].first;
  }
  for (i = 1; i < n; i++) {
    if (K[i] - K[i - 1] > 20) continue;
    long long one = 1LL << (2 * (K[i] - K[i - 1]));
    if ((double)one * A[i] > A[i - 1] || one * A[i] >= A[i - 1]) continue;
    A[i - 1] -= one * A[i];
    A[i] += (A[i - 1] + one - 1) / one;
  }
  long long res = K[n - 1] + 1;
  while (1) {
    if (res - K[n - 1] > 20) {
      cout << res << endl;
      return 0;
    }
    long long one = 1LL << (2 * (res - K[n - 1]));
    if (one >= A[n - 1]) {
      cout << res << endl;
      return 0;
    }
    res++;
  }
}
