728x90
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
using namespace std;
int main() {
int n;
cin >> n;
vector<int>arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
sort(arr.begin(), arr.end());
int total = 0;
for (int i = 0; i < n; i++) {
if (i>0) {
arr[i] = arr[i - 1] + arr[i];
}
total += arr[i];
}
cout << total << endl;
}