def a_atCoder_group_contest(N, A):

    A.sort()

    ans = 0

    for k in range(N):

        group = [A[k], A[3 * N - (2 * k + 2)], A[3 * N - (2 * k + 1)]]

        ans += group[1]

    return ans



N = int(eval(input()))

A = [int(i) for i in input().split()]

print((a_atCoder_group_contest(N, A)))
def a_atCoder_group_contest(N, A):

    A.sort(reverse=True)

    ans = sum(A[1:2 * N:2])  # Aが0-indexedなので、 1, 3,..., 2N-1 番の和をとる

    return ans



N = int(eval(input()))

A = [int(i) for i in input().split()]

print((a_atCoder_group_contest(N, A)))
def a_atCoder_group_contest(N, A):
    A.sort()
    ans = 0
    for k in range(N):
        group = [A[k], A[3 * N - (2 * k + 2)], A[3 * N - (2 * k + 1)]]
        ans += group[1]
    return ans


N = int(eval(input()))
A = [int(i) for i in input().split()]
print((a_atCoder_group_contest(N, A)))

def a_atCoder_group_contest(N, A):
    A.sort(reverse=True)
    ans = sum(A[1 : 2 * N : 2])  # Aが0-indexedなので、 1, 3,..., 2N-1 番の和をとる
    return ans


N = int(eval(input()))
A = [int(i) for i in input().split()]
print((a_atCoder_group_contest(N, A)))

-    A.sort() -    ans = 0 -    for k in range(N): -        group = [A[k], A[3 * N - (2 * k + 2)], A[3 * N - (2 * k + 1)]] -        ans += group[1] +    A.sort(reverse=True) +    ans = sum(A[1 : 2 * N : 2])  # Aが0-indexedなので、 1, 3,..., 2N-1 番の和をとる