import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int n = sc.nextInt();
//转化成二进制串
String str = Integer.toBinaryString(n);
//对0进行分割,将连续的1都存到数组里
String[] arr =str.split("0");
int max=0;
for(String s :arr){
max=s.length()>max?s.length():max;
}
System.out.println(max);
}
}
}