while True:
try:
s = bin(int(input()))[2:]+'E'
t=[]
max_num=0
for i in range(len(s)):
if s[i]=='1':
num=0
for j in range(i,len(s)):
if s[j]=='1':
num+=1
else:
if num > max_num:
max_num=num
break
print(max_num)
except:
break