n=int(input()) if n>1: print(0) exit() print(sum(((n>>i)&1)*i for i in range(60))+(n&1))