#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using tpl = tuple<int, int, int>;
using pcc = pair<char, char>;
const ll inf = 2e18;
const ll mod = 1e8;
int dr[] = {-1, 0, 1, 0};
int dc[] = {0, 1, 0, -1};
int kr[] = {-1, 1, -2, -2, -1, 1, 2, 2};
int kc[] = {-2, -2, -1, 1, 2, 2, -1, 1};
int dgr[] = {-1, -1, 1, 1};
int dgc[] = {1, -1, -1, 1};
int main() {
  int n;
  cin >> n;
  pair<ll, ll> ara[n];
  map<ll, ll> mp, cnt;
  for (int i = 0; i < n; i++) {
    cin >> ara[i].first >> ara[i].second;
    mp[ara[i].first] += ara[i].second;
  }
  sort(ara, ara + n);
  ll ans = inf, lo, hi = 2e9, mid;
  lo = max(ara[n - 1].first, (ll)1);
  while (lo <= hi) {
    mid = lo + (hi - lo) / 2;
    if (mid - ara[n - 1].first > 15) {
      hi = mid - 1;
    } else {
      bool ok = true;
      for (int i = n - 1; i >= 0; i--) {
        if (mid - ara[i].first > 15) continue;
        ll ck = (ll)pow(4, mid - ara[i].first);
        if (ck < ara[i].second) {
          ok = false;
          break;
        }
      }
      if (ok) {
        ans = min(ans, mid);
        hi = mid - 1;
      } else {
        lo = mid + 1;
      }
    }
  }
  if (ans == ara[n - 1].first) ans++;
  cout << ans << endl;
  return 0;
}
