N=int(input()) A=N*2 B=N while N>0: N//=2 B+=N print(A-B)