#include <bits/stdc++.h>
using namespace std;
const int MAX_N = (int)3E5 + 1;
int arr[MAX_N];
long long sum[MAX_N];
inline bool larCmp(int a, int b) { return a > b; }
long long getSum(int low, int up) {
  if (low == up) return arr[low];
  long long ans = sum[up + 1] - sum[low];
  ans += getSum(low, up - 1) + arr[up];
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", arr + i);
  }
  sort(arr, arr + n, larCmp);
  sum[0] = 0LL;
  for (int i = 0; i < n; i++) {
    sum[i + 1] = sum[i] + arr[i];
  }
  printf("%I64d", getSum(0, n - 1));
  return 0;
}
