program kabelis;
 var f: text;
     n, suma: longint;
begin
  assign(f, 'kabelis.in');
  reset(f);
  read(f, n);
  close(f);
  suma := n;
  while n > 1 do
    begin
      suma := suma + n div 2;
      n := n div 2 + n mod 2
    end;
  assign(f, 'kabelis.out');
  rewrite(f);
  write(f, suma);
  close(f);
end.