import java.util.; import java.io.; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader in= new BufferedReader(new InputStreamReader(System.in)); String str; while((str = in.readLine()) != null){ int n = Integer.parseInt(str); int max = 0; int count = 0; while(n != 0 ){ if((n&1) == 1) { count ++; max = Math.max(max,count); }else{ count = 0;

            }
            n >>>= 1;
        }
        System.out.println(max);
     
    }
}

}