#include<cstdio>
#include<algorithm>
using namespace std;
int main() {
int n; scanf("%d", &n);
int p = 0, maxk = 0;
for(int i = 0; i < n; i++) {
int k, a; scanf("%d %d", &k, &a);
maxk = max(k, maxk);
int m = 0, s = 1;
while(s < a) {
s *= 4;
m++;
}
p = max(p, k+m);
}
if(p == maxk) {
p++;
}
printf("%d\n", p);
}
I2luY2x1ZGU8Y3N0ZGlvPgojaW5jbHVkZTxhbGdvcml0aG0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKICAgIGludCBuOyBzY2FuZigiJWQiLCAmbik7CglpbnQgcCA9IDAsIG1heGsgPSAwOwoJZm9yKGludCBpID0gMDsgaSA8IG47IGkrKykgewoJCWludCBrLCBhOyBzY2FuZigiJWQgJWQiLCAmaywgJmEpOwoJCW1heGsgPSBtYXgoaywgbWF4ayk7CgkJaW50IG0gPSAwLCBzID0gMTsKCQl3aGlsZShzIDwgYSkgewoJCQlzICo9IDQ7CgkJCW0rKzsKCQl9CgkJcCA9IG1heChwLCBrK20pOwoJfQoJaWYocCA9PSBtYXhrKSB7CgkJcCsrOwoJfQoJcHJpbnRmKCIlZFxuIiwgcCk7Cn0K