def main(): n = int(input()) A = list(map(int, input().split())) A.sort() A, B = A[n//2:], A[:n//2] return sum(A)+sum(B) print(main())