#include<stdio.h>
int main(){
    int data;
    while(scanf("%d",&data)!=EOF){
        int count=1;
        int jilu=-1;
        int k;
        int max=0;
        while(data!=0){
            if(data%2==1){
                if(jilu==1)
                    count++;
                jilu=data%2;
            }
            else{
                jilu=0;
                count=1;
            }
            data/=2;
            if(max<count)
                max=count;
        }
        printf("%d\n",max);
    }
    return 0;
}