#include <bits/stdc++.h>
using namespace std;
struct Input {
  int readInt() {
    int x;
    scanf("%d", &x);
    return x;
  }
  long long readLong() {
    long long x;
    scanf("%lld", &x);
    return x;
  }
  char readChar() {
    char c;
    scanf("%c", &c);
    return c;
  }
  double readDouble() {
    double x;
    scanf("%lf", &x);
    return x;
  }
  string readString() {
    char str[100005];
    scanf("%s", &str);
    return str;
  }
  void readIntArray(int* arr, int st, int en) {
    for (int i = st; i <= en; i++) arr[i] = readInt();
  }
} in;
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    std::cout << v << ' ';
    return *this;
  }
} dbg;
int n, ans;
vector<pair<int, int> > v;
int log_factor(int a, int b) {
  int res = a;
  for (; b > 0; b >>= 2) res++;
  return res;
}
int call(int idx, int p) {
  if (idx == n) return p;
  int k = v[idx].first;
  int t = v[idx].second;
  if (k + 1 > p) p = k + 1;
  int lf = log_factor(k, t - 1);
  p = max(lf, p);
  return call(idx + 1, p);
}
int main(int argc, char const* argv[]) {
  n = in.readInt();
  for (int i = 0; i <= n - 1; i++) {
    int k = in.readInt();
    int a = in.readInt();
    v.push_back({k, a});
  }
  sort(v.begin(), v.end());
  int res = call(0, v[0].first);
  printf("%d\n", res);
  return 0;
}
