#include <bits/stdc++.h>
using namespace std;
namespace HABIT {
const int MAXN = 1e5 + 10;
typedef long long int ar[MAXN];
template <typename T>
inline T Max(T a) {
  return a;
}
template <typename T, typename... Args>
inline T Max(T a, Args... args) {
  T b = Max(args...);
  return (a > b) ? a : b;
}
template <typename T>
inline T Min(T a) {
  return a;
}
template <typename T, typename... Args>
inline T Min(T a, Args... args) {
  T b = Min(args...);
  return (a < b) ? a : b;
}
inline char gc() { return getchar(); }
inline long long int read() {
  register long long int ans = 0;
  register char c = gc();
  register bool neg = 0;
  while (c < 48 || c > 57) neg ^= !(c ^ '-'), c = gc();
  while (c >= 48 && c <= 57) ans = (ans << 3) + (ans << 1) + (c ^ 48), c = gc();
  return neg ? -ans : ans;
}
char Output_Ans[1 << 20 | 1], *Output_Cur = Output_Ans;
inline void output() {
  Output_Cur -= fwrite(Output_Ans, 1, Output_Cur - Output_Ans, stdout);
}
inline void print(char c) {
  if (Output_Cur - Output_Ans + 1 >> 20) output();
  *(Output_Cur++) = c;
}
inline void print(char *s) {
  while (*s) print(*(s++));
}
inline void print(unsigned long long int x) {
  if (!x) {
    print('0');
    return;
  }
  char buf[30] = {0}, *p = buf + 28;
  while (x) *(p--) = x % 10 + 48, x /= 10;
  print(p + 1);
}
inline void print(unsigned int x) { print((unsigned long long int)x); }
inline void print(long long int x) {
  if (x < 0) print('-'), x = -x;
  print((unsigned long long int)x);
}
inline void print(int x) {
  if (x < 0) print('-'), x = -x;
  print((unsigned long long int)x);
}
}  // namespace HABIT
using namespace HABIT;
pair<long long int, long long int> Box[MAXN];
int main() {
  int N = read(), P, C = 1;
  for (register int i = 1, I = N; i <= I; i++)
    Box[i].first = read(), Box[i].second = read();
  sort(Box + 1, Box + 1 + N);
  P = Box[N].first;
  for (register int i = 1, I = N; i <= I; i++) {
    int Tmp = Box[i].second;
    for (register int j = Box[i].first + 1, J = Box[i + 1].first; j <= J; j++)
      Tmp = Tmp + 3 >> 2;
    Box[i + 1].second = Max(Box[i + 1].second, Tmp);
  }
  if (Box[N].second == 1)
    P++;
  else {
    while (C < Box[N].second) {
      P++;
      C <<= 2;
    }
  }
  print(P);
  output();
  return 0;
}
