# 求一个二进制数的1的最大连续数
def lx(n):
    arr = [1]
    for i in range(1, len(n) + 1):
        if '1'* i in n:
            arr.append(i)
    return max(arr)


while True:
    try:
        n = int(input())
        s = bin(n).replace('0b', '')
        print(lx(s))
    except:
        break