#include<bits/stdc++.h>
using namespace std;
//time :- O(n) || Space :- O(n) where n = no of processors
int findTotalExecutionTime(vector<int>& execution){
unordered_map<int, int> map;
for(auto it : execution)
map[it] += 1;
long result = 0LL;
for(auto it : map){
int time = it.first;
int noOfProcessors = it.second;
while(time > 0 && noOfProcessors > 0){
result += time;
noOfProcessors--;
time = ceil(time / 2.0);
}
}
return result;
}
int main(){
int n;
cin >> n;
vector<int> execution;
while(n > 0){
int time;
cin >> time;
execution.push_back(time);
n--;
}
cout << findTotalExecutionTime(execution) << endl;
return 0;
}