while True: try: import re i=1 B=[] string=bin(int(input())) l=string.count('1') for i in range(1,l+1): parrten=re.compile(r"1"*i,re.I) APP=parrten.findall(string) if len(APP) != 0: B.append(i) out1=max(B) print(out1) except: break
while True: try: import re i=1 B=[] string=bin(int(input())) l=string.count('1') for i in range(1,l+1): parrten=re.compile(r"1"*i,re.I) APP=parrten.findall(string) if len(APP) != 0: B.append(i) out1=max(B) print(out1) except: break