import sys while True: try: a = bin(int(input())) a = str(a)[2:] res = 0 max_ =0 for i in a: if i =='0': res =0 else : res+=1 if res > max_: max_=res print (max_) except: break