a = int(input()) b = list(map(int,input().split())) c = 0 b.sort() for i in range(a-1): c += sum(b) b.pop() print(c)