import strutils let n = parseInt readLine stdin var x = n sum = 0 while x > 0: sum.inc x x = x div 2 echo 2 * n - sum