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