import strutils let N = stdin.readLine.parseInt var n = N cnt = 0 while n != 0: cnt += n n = n div 2 echo 2 * N - cnt