import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args) throws Exception{
BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
String str = null;
while((str=b.readLine())!=null){
int n=Integer.parseInt(str);
int res=0;
int num=0;
while(n!=0){
if((n&1)==1)
num++;
else num=0;
n>>=1;
//System.out.print(num);
if(res<num)
res=num;
//res=max(num,res);
}
System.out.println(res);
}
}
}