let str;
while(str = readline()){
    let num = parseInt(str);
    let str1 = num.toString(2);
    let arr1 = str1.split('');
    let count = 0;
    let max = 0;
    for(let i = 0;i<arr1.length;i++) {
        if(arr1[i] == '1') {
            count++;
            if(i == arr1.length - 1){
                max = Math.max(max,count);
            }
        }else {
            max = Math.max(max,count);
            count = 0;
        }
    }
    console.log(max);
}