import java.util.Scanner; class YukiCoder01 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextLong(); long k = N; long i = N; long Na = N*2; long Nb= 0; while (k !=0){ k=k/2; i=i+k; } Nb = i; long gap =Na-Nb; //System.out.println(Na); //System.out.println(Nb); System.out.println(gap); } }