n = int(input())
current = 0
maxi = 0
while n > 0:
    rem = n % 2
    if rem is 1:
        current += 1
        if current > maxi:
            maxi = current
    else:
        current = 0
    n = n // 2
print(maxi)

b380d1b5646a6139c13921f3064a9006b5a3e209
<mask token>

<mask token>
while n > 0:
    rem = n % 2
    if rem is 1:
        current += 1
        if current > maxi:
            maxi = current
    else:
        current = 0
    n = n // 2
print(maxi)

n = int(input())
current = 0
maxi = 0
while n > 0:
    rem = n % 2
    if rem is 1:
        current += 1
        if current > maxi:
            maxi = current
    else:
        current = 0
    n = n // 2
print(maxi)
