import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int i,j=0,k=0; int n = in.nextInt(); int[] calories = new int[n]; for(i=0; i < n;i++){ calories[i] = in.nextInt(); } Arrays.sort(calories); for(i=n;i>0;i--){ sum=sum+(int)Math.pow(2,j)*i; j=j+1; } System.out.println(sum); // your code goes here } }