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