using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] calories_temp = Console.ReadLine().Split(' '); int[] c = Array.ConvertAll(calories_temp,Int32.Parse); Array.Sort(c); long total = 0; for (int i = 0; i < n; i++){ int j = n - 1 - i; total += c[j] * (long)Math.Pow(2, i); } Console.WriteLine(total); } }