n = int(input()) s = 0 m = int(n) while m > 0: m /= 2 s += m print(n-s)