#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5, Log = 15;
int pot[Log];
map<int, int> m;
void precompute() {
  pot[0] = 1;
  for (int i = 1; i < Log; i++) {
    pot[i] = pot[i - 1] * 4;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  precompute();
  int n;
  cin >> n;
  int a, b;
  int maksi = 0;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    m[a] = b;
    maksi = max(maksi, a);
  }
  pair<int, int> p;
  map<int, int>::iterator it = m.begin();
  bool pamtim = 0;
  for (map<int, int>::iterator it = m.begin(); it != m.end(); it++) {
    p = *it;
    if (m[p.first] > 1 || pamtim) {
      m[p.first + 1] = max((p.second + 3 + pamtim) / 4, m[p.first + 1]);
      pamtim = 0;
    } else {
      pamtim = 1;
    }
  }
  if (p.first == maksi) {
    cout << p.first + 1 << '\n';
  } else {
    cout << p.first << '\n';
  }
  return 0;
}
