while(line = readline()) {
const radix2 = parseInt(line).toString(2);
let subArr = [];
for (let i = 0; i <= radix2.length; i++) {
for (let j = i + 1; j <= radix2.length; j++) {
let temp = radix2.slice(i, j);
if (judge(temp)) {
subArr.push(temp.length);
}
}
}
print(Math.max.apply(null, subArr))
}
function judge(target) {
let reg = new RegExp('[0]', 'g')
let temp = target.match(reg);
return temp ? false : true;
}