• + 0 comments

    !/bin/python3

    import math import os import random import re import sys

    if name == 'main': n = int(input().strip()) arr = []

    while n > 0:
        arr.append(n % 2)
        n = n // 2
    
    # print(arr)
    arr = arr[::-1]
    # print(arr)
    
    count = 0
    max_count = 0
    i = 0
    while i < len(arr):
        if arr[i] == 0:            
            if count > max_count:
                max_count = count
            count = 0
        else:
            count += 1
            if count > max_count:
                max_count = count
    
        i += 1
    
    print(max_count)