N=int(input()) skill = 2*N nomal = 0 for i in range(200): nomal+=N N//=2 if N==0: break print(skill - nomal)