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) { long miles=0; long p=1; Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] calories = new int[n]; for(int calories_i=0; calories_i < n; calories_i++){ calories[calories_i] = in.nextInt(); } // your code goes here for(int i = 0; icalories[j+1]) { int temp; temp = calories[j]; calories[j] = calories[j+1]; calories[j+1] = temp; } } } for(int i = n-1 ; i>=0 ; --i) { miles = miles+calories[i]*p; p = p*2; } System.out.println(miles); } }