#include <bits/stdc++.h>
using namespace std;
long long int a[2000006];
long long int b[2000006];
stack<long long int> st;
vector<pair<long long int, long long int> > v;
set<pair<long long int, long long int> > s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, i, j, k, l, m, d;
  cin >> n;
  a[1] = 4;
  for (i = 2; i <= 16; i++) a[i] = 4 * a[i - 1];
  for (i = 0; i < n; i++) {
    cin >> k >> l;
    v.push_back(make_pair(k, l));
  }
  sort(v.begin(), v.end());
  long long int co = 0;
  long long int bash = 0;
  for (i = 0; i < n - 1; i++) {
    long long int temp = v[i + 1].first - (v[i].first);
    if (temp <= 16) {
      long long int temp1 = a[temp];
      if ((v[i].second + co) % temp1 == 0) {
        bash = (v[i].second + co) / temp1;
      } else {
        bash = (v[i].second + co) / temp1 + 1;
      }
      if (v[i + 1].second < bash)
        co = (bash - v[i + 1].second);
      else
        co = 0;
    }
  }
  long long int remaining = v[n - 1].second + co;
  long long int kola = 4;
  long long int cou = 1;
  while (remaining > kola) {
    kola *= 4;
    cou++;
  }
  cout << v[n - 1].first + cou;
  return 0;
}
