#include <bits/stdc++.h>   using namespace std;   int64_t exp(int64_t a, int64_t b) {     if (b == 0) return 1;     int64_t c = exp(a, b / 2);     c = c * c;     if (b % 2 == 1) c = c * a;     return c;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     int64_t ans = 0;     for (int i = 0; i < n; i++) {       int64_t k, a;       cin >> k >> a;       if (a == 1) {         ans = max(ans, k + 1);         continue;       }       int64_t x = 0;       for (int64_t b = 16; b >= 1; b /= 2) {         while (exp(4, b + x) < a) x += b;       }       ans = max(ans, k + x + 1);     }     cout << ans;   }   