#include <bits/stdc++.h>
using namespace std;
int n;
pair<long long, long long> arr[(int)1e5 + 5];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
  }
  sort(arr, arr + n);
  long long cur = 0;
  for (int i = 0; i < n - 1; i++) {
    cur -= min(cur, arr[i].second);
    arr[i].second += cur;
    long long diff = arr[i + 1].first - arr[i].first;
    while (diff--) {
      arr[i].second = (arr[i].second + 3) / 4;
      if (arr[i].second <= 1) break;
    }
    cur = arr[i].second;
  }
  cur -= min(cur, arr[n - 1].second);
  long long ans = arr[n - 1].first, val = arr[n - 1].second + cur;
  while (val > 1) {
    val = (val + 3) / 4;
    ans++;
  }
  if (ans == arr[n - 1].first) ans++;
  cout << ans << "\n";
}
