while True:
    try:
        s=bin(int(input()))[::-1]
        # print(s)
        count=[]
        tmp=0
        for a in s:
            if a=='1':
                tmp+=1
            else:
                count.append(tmp)
                tmp=0
        print(max(count))
  
    except:
        break