#include<stdio.h>

int f_max(int a, int b){ return a>b?a:b; }

int main(){

int number;
while(scanf("%d", &number) != EOF){
    int lenth = 0;
    int ans = 0;
    for(int i=0; i<21; i++){
        if(number & 1 == 1){
            lenth++;
        }
        else{
            ans = f_max(ans, lenth);
            lenth = 0;
        }
        number >>= 1;
    }
    printf("%d\n", ans);
}

}