#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T min(T &a, T &b) {
  return a < b ? a : b;
}
template <class T>
inline T max(T &a, T &b) {
  return a > b ? a : b;
}
template <class T>
void read(T &x) {
  char ch;
  while ((ch = getchar()) && !isdigit(ch))
    ;
  x = ch - '0';
  while ((ch = getchar()) && isdigit(ch)) x = x * 10 + ch - '0';
}
struct point {
  int x, y;
  point() {}
  point(int _x, int _y) : x(_x), y(_y) {}
};
long long Pow(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long Pow(long long a, long long b) {
  long long res = 1;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    a = a * a;
  }
  return res;
}
pair<int, int> P[120000];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &P[i].first, &P[i].second);
  sort(P + 1, P + n + 1);
  for (int i = 1; i <= n - 1; i++)
    if (P[i + 1].first - P[i].first <= 14 &&
        P[i].second > Pow(4, P[i + 1].first - P[i].first) * P[i + 1].second) {
      int c = (int)Pow(4, P[i + 1].first - P[i].first);
      P[i].second -= P[i + 1].second * c;
      P[i + 1].second +=
          P[i].second % c == 0 ? P[i].second / c : P[i].second / c + 1;
    }
  int ans = P[n].first;
  while (P[n].second > 4) {
    ans++;
    P[n].second = P[n].second % 4 == 0 ? P[n].second / 4 : P[n].second / 4 + 1;
  }
  printf("%d\n", ans + 1);
}
