package oj.test;
import java.util.*;
public class Demo5 {
/**
* @求最大连续bit数
* 功能: 求一个byte数字对应的二进制数字中1的最大连续数,例如3的二进制为00000011,最大连续2个1
*/
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String str = Integer.toBinaryString(n);
char[] chs = str.toCharArray();
int max = 0;
int count = 1;
for(int i=0;i<chs.length-1;i++){
if(chs[i]=='1' && chs[i+1]=='1')
count ++;
else{
count=1;
}
if(count>max){
max=count;
}
}
//sop(str);
sop(max);
}
private static void sop(Object o) {
System.out.println(o);
}
}