N=int(input()) count=-1 tmp=N while tmp>=1: count+=1 tmp=tmp/2 tmp=N-2**count if tmp%2==0 and tmp==0: print(count) elif tmp%2==0 or tmp==1: print(count+1) else: print(count+2)