import std.stdio; void main(){ auto io = new IO(); long N = io.rect!long(1)[0][0]; long skill = N*2; long normal = 0; for( long n = N ; 0 < n ; n /= 2 ){ normal += n; } writeln( skill-normal ); return; } auto solve(){ } unittest{ } import std.stdio,std.conv,std.string; import std.algorithm,std.array,std.math; class IO { T[] line( T = size_t , string token = " " )( size_t m = 1 ){ T[] arr = []; foreach( i ; 0..m ){ arr ~= this.read!T(); } return arr; } T[][] rect( T = size_t , string token = " " )( size_t m = 1 ){ T[][] arr = new T[][](m); foreach( i ; 0..m ){ arr[i] = this.read!T(token); } return arr; } private T[] read( T = size_t )( string token = " " ){ T[] arr; foreach( elm ; readln().chomp().split(token) ){ arr ~= elm.to!T(); } return arr; } }