#include <bits/stdc++.h>
using namespace std;
const int X = 200000;
long long deg[50], num[X], k[X], a[X];
long long n, i, l, r, mid;
bool check(long long N) {
  for (i = 1; i <= n; i++)
    if (num[i] > (long long)2 * N - (long long)2 * k[i]) return 0;
  return 1;
}
int main() {
  deg[0] = 1LL;
  for (i = 1; i <= 35; i++) deg[i] = (long long)deg[i - 1] * 2LL;
  l = -1;
  scanf("%I64d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%I64d %I64d", &k[i], &a[i]);
    num[i] = 0;
    while (a[i] > (long long)deg[num[i]]) num[i]++;
    l = max(l, k[i]);
  }
  l++;
  r = 10000000000LL;
  while (l < r) {
    mid = (l + r) >> 1;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
    if (r == l + 1)
      if (check(l))
        r--;
      else
        l++;
  }
  printf("%I64d\n", l);
}
