import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int count = 0;
        int result = 0;
        while(n != 0) {
            if((n & 1) == 1) {  // 如果最右侧为1
                count++;
                result = Math.max(result, count);
            } else {
                // 重置
                count = 0;
            }

            n = n >>> 1;    // 右移一位
        }

        result = Math.max(result, count);
        System.out.println(result);
    }
}