#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  priority_queue<int, vector<int>, greater<int> > pq;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    pq.push(a[i]);
  }
  int x, y, ans = 0;
  while (pq.empty() == false) {
    x = pq.top();
    pq.pop();
    y = pq.top();
    pq.pop();
    ans += (x + y) / 2;
    pq.push((x + y) / 2);
  }
  cout << ans;
}
