n=int(input())
s=bin(n)
ans=0
l=0
for i in s:
    if i=='1':
        l+=1
        ans=max(l,ans)
    else:
        l=0
print(ans)