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