while True:
try:
n = int(input())
s = bin(n).replace('0b', '')
s = (8 - len(s)) * '0' + s
Max, count = 1, 1
i = s.index('1')
while i < len(s) - 1:
for j in range(i+1, len(s)):
if s[j] == '1':
count += 1
else:
break
Max = max(Max, count)
if '1' in s[j+1:]:
i = s.index('1', j+1)
count = 1
else:
break
print(Max)
except:
break