#include <bits/stdc++.h>
using namespace std;
long long log4(long long a) {
  long long temp = a;
  long long ans = 0;
  while (a) {
    ans++;
    a >>= 2;
  }
  if (2 << (ans - 1) == temp) return ans - 1;
  return ans;
}
int main() {
  long long n;
  scanf("%lld", &n);
  vector<pair<long long, long long> > v(n);
  for (long long i = 0; i < n; i++)
    scanf("%lld %lld", &v[i].first, &v[i].second);
  sort(v.begin(), v.end());
  long long type = v[0].first, count = v[0].second;
  for (long long i = 1; i < n; i++) {
    long long c = v[i].first - type, d = 0;
    if (c < log4(count)) {
      d = (count - 1) / (4 << (2 * (c - 1))) + 1;
      type = v[i].first;
      count = max(d, v[i].second);
    } else {
      type = v[i].first;
      count = v[i].second;
    }
  }
  long long a = 4;
  type++;
  while (a < count) {
    a *= 4;
    type++;
  }
  cout << type << endl;
  return 0;
}
