#coding: utf-8 #yuki_378 n=int(raw_input()) def sgs(x): res=x i=x while True: res+=i/2 if i==0: break i/=2 return res y=n*2 print y-sgs(n)