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 n = in.nextInt(); int[] cal = new int[n]; for(int i=0; i < n; i++){ cal[i] = in.nextInt(); } Arrays.sort(cal); long ans=0; int j=0; for(int i=n-1;i>=0;i--) { ans+=cal[i]*Math.pow(2,j); j++; } System.out.println(ans); // your code goes here } }