n=int(input()) sum=n half=2*(n//2)+n while n!=0: sum+=n//2 n//=2 print(abs(sum-half))