#!/bin/python3

import sys

n = int(input().strip())
m = []

while n > 0:
    if n % 2 == 0:
        m.append(0)
        n = n // 2
    else:
        m.append(1)
        n = n // 2

m.reverse() 

count = 1
maximum = 1
for i in range(0, len(m)-1):
    
    if m[i] == 1:
        
        if m[i+1] == 1:
            
            count += 1
            
            if count > maximum:
                
                maximum = count
            
        else:
            count = 1
            
print(maximum)                 
