#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
char dir[] = {'R', 'L', 'D', 'U'};
const int MOD = 1e9 + 7;
const long long INF = 1e9;
void setIO(string filename) {
  if (fopen((filename + ".in").c_str(), "r")) {
    freopen((filename + ".in").c_str(), "r", stdin);
    freopen((filename + ".out").c_str(), "w", stdout);
  }
}
void solve() {
  int n;
  cin >> n;
  vector<pair<long long, long long> > a(n);
  for (auto &i : a) cin >> i.first >> i.second;
  sort((a).begin(), (a).end());
  for (int i = 0; i < n - 1; i++) {
    pair<long long, long long> curr = a[i];
    if (a[i + 1].first - a[i].first >= 30)
      continue;
    else {
      while (curr.first < a[i + 1].first) {
        curr.second = (curr.second + 4 - 1) / 4;
        curr.first++;
      }
      a[i + 1].second += max(0ll, curr.second - a[i + 1].second);
    }
  }
  long long ans = a.back().first;
  while (a.back().second > 1) {
    ;
    a.back().second = (a.back().second + 4 - 1) / 4;
    ans++;
  }
  cout << max(1ll, ans + (a.back().first == ans)) << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) solve();
  return 0;
}
