while True:
    try:
        nums = str(bin(int(input())))[2:]
        counts = 0
        MaxCount = 0
        for x in nums:
            if x == "1":
                counts += 1
            else:
                MaxCount = max(MaxCount, counts)
                counts = 0
        MaxCount = max(MaxCount, counts)
        print(MaxCount)
    except:
        break