"#!/usr/bin/env python3"



N = int(eval(input()))

L = list(map(int,input().split()))



L = sorted(L)



ans = 0

for i in range(0, 2*N, 2) :

    ans += L[i]



print(ans)

N = int(eval(input()))

L = list(map(int,input().split()))

L.sort()

ans = 0

for i in range(0,2*N,2) :

    ans += L[i]

print(ans)

"#!/usr/bin/env python3"
N = int(eval(input()))
L = list(map(int, input().split()))
L = sorted(L)
ans = 0
for i in range(0, 2 * N, 2):
    ans += L[i]
print(ans)

N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(0, 2 * N, 2):
    ans += L[i]
print(ans)

-"#!/usr/bin/env python3" -L = sorted(L) +L.sort()