N = int(input()) A = list(map(int, input().split())) A.sort() ans = sum(A[:(N+1)//2]) + sum(A[(N+1)//2:]) print(ans)