import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int num = sc.nextInt();
String binaryString = Integer.toBinaryString(num);
int max = 0;
int sum = 0;
for (int i = 0; i < binaryString.length(); i++) {
if (binaryString.charAt(i) == '1') {
sum++;
max = Math.max(max, sum);
} else {
sum = 0;
}
}
System.out.println(max);
}
sc.close();
}
}