import java.util.Scanner;

public class Main {

    private int countBiggestOf1(int n) {
        int res = 0;
        int temp = 0;
        while (n != 0) {
            if ((n & 1) == 1) {
                temp++;
            }
            else {
                temp = 0;
            }
            n = n >>> 1;
            res = Math.max(res, temp);
        }
        return res;
    }
    public Main() {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int n = in.nextInt();
            int res = countBiggestOf1(n);
            System.out.println(res);
        }
    }

    public static void main(String[] args) {
        Main solution = new Main();
    }
}