package net.ipipip0129.yukicoder.no378; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); long exp = scan.nextLong(); long total_exp = exp; long max_exp = exp * 2; while (exp != 0) { total_exp += exp/2; exp /= 2; } System.out.println(max_exp - total_exp); } }