import javax.swing.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int n = sc.nextInt();
            String s = Integer.toBinaryString(n);
            int res = getRes(s);
            System.out.println(res);
        }
    }

    private static int getRes(String s) {
        int count = 1;
        StringBuilder sb = new StringBuilder(s);
        for (int i = 0; i < sb.length(); i++) {
            if (sb.charAt(i) == '1') {
                int num = 1;
                for (int j = i + 1; j < sb.length(); j++) {
                    if(sb.charAt(j) == '1'){
                        num++;
                        count = Math.max(num, count);
                    }else{
                        break;
                    }
                }
            }
        }
        return count;
    }
}