#include <bits/stdc++.h>
using namespace std;
long n;
long a[100009], k[100009];
void nhap() {
  long i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d%d", &k[i], &a[i]);
}
void qs(long left, long right) {
  long tam, mid, i, j;
  i = left;
  j = right;
  mid = k[left + (rand() % (right - left + 1))];
  while (i <= j) {
    while (k[i] < mid) i++;
    while (k[j] > mid) j--;
    if (i <= j) {
      if (i < j) {
        tam = k[i];
        k[i] = k[j];
        k[j] = tam;
        tam = a[i];
        a[i] = a[j];
        a[j] = tam;
      }
      i++;
      j--;
    }
  }
  if (left < j) qs(left, j);
  if (i < right) qs(i, right);
}
void xuly() {
  long i, j, dem;
  long long sum, trc, lt;
  qs(1, n);
  trc = 0ll;
  for (i = 1; i <= n - 1; i++) {
    sum = (long long)a[i];
    if (trc > sum) sum = trc;
    lt = 1ll;
    for (j = 1; j <= k[i + 1] - k[i]; j++) {
      lt *= 4ll;
      if (lt >= sum) break;
    }
    if (lt >= sum)
      trc = 0ll;
    else {
      trc = sum / lt;
      if (sum % lt) trc++;
    }
  }
  sum = (long long)a[n];
  if (trc > sum) sum = trc;
  lt = 1ll;
  dem = 0;
  while (lt < sum) {
    lt *= 4ll;
    dem++;
  }
  if (!dem) dem++;
  cout << k[n] + dem;
}
int main() {
  nhap();
  xuly();
  return 0;
}
