Problem:
 Score : 300 points    Problem Statement There are 3N participants in AtCoder Group Contest .
The strength of the i -th participant is represented by an integer a_i .
They will form N teams, each consisting of three participants.
No participant may belong to multiple teams.  The strength of a team is defined as the second largest strength among its members.
For example, a team of participants of strength 1 , 5 , 2 has a strength 2 , and a team of three participants of strength 3 , 2 , 3 has a strength 3 .  Find the maximum possible sum of the strengths of N teams.      Constraints  1 ≤ N ≤ 10^5  1 ≤ a_i ≤ 10^{9}  a_i are integers.         Input Input is given from Standard Input in the following format:  N  a_1  a_2  ...  a_{3N}       Output Print the answer.        Sample Input 1 2
5 2 8 5 1 5      Sample Output 1 10  The following is one formation of teams that maximizes the sum of the strengths of teams:   Team 1 : consists of the first, fourth and fifth participants.  Team 2 : consists of the second, third and sixth participants.        Sample Input 2 10
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000      Sample Output 2 10000000000  The sum of the strengths can be quite large.

Solution (Python):
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from collections import deque
sys.setrecursionlimit(10**7)
def gcd(a,b):return fractions.gcd(a,b) 
def lcm(a,b):return (a*b) // fractions.gcd(a,b) 
def iin(): return int(input()) 
def isn(): return input().split() 
def imn(): return map(int, input().split()) 
def iln(): return list(map(int, input().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 

N = iin()
a = iln_r()

ans = 0
for i in range(0,N):
    ans += a[(i*2)+1]
print(ans)

Solution (Python):
n = int(input())
al = list(map(int, input().split()))

a_s = sorted(al, reverse=True)
strength = 0

for i in range(1, 2*n+1, 2):
    strength += a_s[i]

print(strength)

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
A = sorted([int(_) for _ in stdin.readline().rstrip().split()])
ans = 0
for i in range(0, N*2, 2):
    ans += A[N+i]
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

A=sorted(A)

t=0
for i in range(N):
    a=A[3*N-i*2-2]
    t+=a
print(t)

Solution (Python):
n = int(input())
lista = list(map(int, input().split()))

lista.sort()

print(sum(lista[-2:(-2 - 2 * n):-2]))

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
count = 0
for i in range(0,2*N,2):
    count += a[i+1]
print(count)

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort()
point = 0
for i in range(n):
    point += li[-2*(i+1)]
print(point)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)
maxScoreArray = []
for i in range(N):
  maxScoreArray.append(a[i*2+1])

print(sum(maxScoreArray))

Solution (Python):
N=int(input())
t = list(map(int,input().split()))

newLi = sorted(t, reverse=True)
ans = 0

for i in range(N):
  ans += newLi[i * 2 + 1]

print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
ans = 0
for i in range(n):
    ans += a[2*i+1]
print(ans)

Solution (Python):
n = int(input())
ls = list(map(int, input().split()))

ls.sort(reverse=True)

ans = 0

for i in range(2 * n):
    if i % 2 == 1:
        ans += ls[i]

print(ans)

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)

ans = 0

for i in range(1, 2*n, 2):
    ans += a[i]

print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a.sort()

ans = 0
for i in range(2,2*n+1,2):
	ans += a[-i]

print(ans)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))

count=0
a.sort(reverse=True)

for i in range(1,2*N,2):
   count+=a[i]

print(count)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = II()
    a = LI()
    a.sort()
    print(sum(a[n::2]))
    return



if __name__ == '__main__':
    solve()

Solution (Python):
N = int(input())
A = sorted(list(map(int,input().split())))
cnt = 0
cur = 0
for i in range(3*N-1,-1,-2):
    a,b = A[i],A[i-1]
    cnt += b
    cur += 1
    if cur==i-1:break
print(cnt)

Solution (Python):
from sys import stdin


if __name__ == "__main__":
    N = int(stdin.readline())
    a = [int(item) for item in stdin.readline().split()]

    a.sort(reverse=True)
    total = 0
    for i in range(N):
        index = 1 + i*2
        total += a[index]
    print(total)

Solution (Python):
n= int(input())
a=sorted(list(map(int,input().split())),reverse=True)
ans=0
for i in range(1,2*n+1,2):
	ans+=a[i]
print(ans)

Solution (Python):
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    A.sort()
    print(sum(A[3*N-2:N-1:-2]))


if __name__ == '__main__':
    main()

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,*A = map(int,read().split())

A.sort()
answer = sum(A[N::2])
print(answer)

Solution (Python):

N = int(input())
a = sorted(map(int, input().split(' ')), reverse=True)

ans = sum([a[i] for i in range(1, 2 * N, 2)])
print(ans)

Solution (Python):
n=int(input())
ln=[int(a) for a in input().split()]
ln.sort(reverse=True)
print(sum(ln[1:n*2:2]))

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
A.sort(reverse = True)

ans = 0
for i in range(1,2*n,2):
    ans += A[i]
print(ans)

Solution (Python):
N = int(input())

nums = sorted(list(map(int, input().split())))

res = 0
for i in range(N):
    res += nums[3 * N - 2 * (i+1)]

print(res)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
print(sum(a[1:2*n:2]))

Solution (Python):
N = int(input())
a = sorted([int(i) for i in input().split()], reverse=True)

ans = []
for i in range(1, len(a), 2):
    if len(ans) < N:
        ans.append(a[i])

print(sum(ans))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = sum(a[n:][0::2])
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()
print(sum(A[3*N-2*i] for i in range(1, N+1)))

Solution (Python):
N = int(input())
A = [int(n) for n in input().split()]

res = 0
sortedA = sorted(A, reverse=True)
for i in range(1, N*2+1, 2):
    res += sortedA[i]

print(res)

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]

ret = 0
a.sort(reverse=True)
for i in range(1, 1 + 2 * N, 2) :
  ret += a[i]

print(ret)

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, a: "List[int]"):
    
    a.sort(reverse=True)

    ans = 0
    for i in range(1, 2*N+1, 2):
        ans += a[i]
    
    print(ans)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    a = [int(next(tokens)) for _ in range(3 * N)]  
    solve(N, a)

if __name__ == '__main__':
    main()

Solution (Python):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    a.sort(reverse=True)
    t = 0
    for i in range(1, n * 2, 2):
        t += a[i]
    print(t)


if __name__ == '__main__':
    solve()

Solution (Python):
N = int(input())
a = sorted(list(map(int,input().split())))
del a[:N]

b = [a[i] for i in range(len(a)) if i%2 == 0]

print(sum(b))

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())))

syo = a[0:n]
tyu = a[n:2*n]
dai = a[2*n:3*n]

l = a[n:3*n]
sec = l[0::2]

print(sum(sec))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

a.pop(0)
for i in range(n):
    a.pop(-1)

count = 0
for i in range(len(a)):
    if i % 2 == 0:
        count += a[i]
    else:
        continue

print(count)

Solution (Python):
n = int(input())
k = n // 3
a = list(map(int, input().split()))

a = sorted(a, reverse = True)
ans = 0
for i in range(2*n):
    if i % 2 == 1:
        ans += a[i]
print(ans)

Solution (Python):
N = int(input())
print(sum(sorted(list(map(int,input().split())))[N:][::2]))

Solution (Python):
def main():
    N = int(input())
    A = [int(a) for a in input().split()]
    A = sorted(A,reverse=True)
    ans = 0
    for i in range(N):
        ans += A[2*i+1]
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 0
for i in range(N):
    ans += a[2*i+1]
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a.sort()

ans = 0
for i in range(n):
    ans += a[n + i * 2]

print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
print(sum(a[1:2 * N + 1:2]))

Solution (Python):
n = int(input())
line = sorted(list(map(int,input().split())),reverse = True)
answer = 0
for i in range(1,2*n,2):
  answer += line[i]
print(answer)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

a = sorted(a)

ans = 0

for i in range(n,n*3,2):
		ans = ans + a[i]
	
print(ans)

Solution (Python):
import sys
import numpy as np

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  


N = ri()
A = np.array(rl())
A.sort()
answer = A[-2:-1-2*N:-2].sum()
print(answer)

Solution (Python):


def main()->None:
    
    
    
    N = int(input()) 
    a = list(map(int, input().split()))
    sorted_a = sorted(a)
    
    sum_a = 0 
    range_N = range(N)
    for i in range(N):
        sum_a += sorted_a[3*N - 2*i - 2]
    print(sum_a)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input()); print(sum(sorted(map(int, input().split()), reverse=True)[1:2*n + 1:2]))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

sum = 0
a.sort()

for i in range(1, n+1):
    sum += a[-2 * i]    

print(sum)

Solution (Python):
n=int(input())
a=sorted(list(map(int,input().split())))
aa=a[n:]
ans=0
for i in range(len(aa)):
 if i%2==0:
  ans+=aa[i]
print(ans)

Solution (Python):
n = int(input())
a = map(int, input().split())

a = sorted(a, reverse=True)
m = 0

for i in range(1, 2 * n, 2):
    m += a[i]

print(m)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

a = sorted(a, reverse=True)

ans = 0
for i in range(N):
    ans += a[i * 2 + 1]

print(ans)

Solution (Python):
def main():
    N = int(input())
    lst = list(map(int, input().split()))

    lst.sort(reverse=True)
    print(sum(lst[1:2*N:2]))

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 0

for i in range(N):
    ans += A[3*N - 2*i - 2]

print(ans)

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())), reverse = True)
print(sum(a[1::2][:n]))

Solution (Python):
n = int(input())
member = sorted(list(map(int,input().split())))
rest = member[n:]
represent = []
for i in range(0,2 * n,2):
  represent.append(rest[i])
print(sum(represent))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
men = []
cnt = 0

for i in range(1, n+1):
    cnt += a[2 * i - 1]
print(cnt)

Solution (Python):
from collections import deque

N = int(input())
A = list(map(int,input().split()))

A = sorted(A)
dq = deque(A)
ans = 0

while dq:
    dq.popleft()
    dq.pop()
    ans += dq.pop()

print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
ans = 0
for i in range(1,n*2,2):
    ans += a[i]
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=1)
ans=0
for i in range(1,2*n,2):
  ans+=a[i]
print(ans)

Solution (Python):
N = int(input())
a_list = list(map(int, input().split()))

a_list.sort(reverse=True)
ans = sum(a_list[1:2*N:2])
print(ans)

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

Solution (Python):
N = int(input())
a = list(map(int, input().split()))


a.sort()

ans = 0

for i in reversed(range(N)):
    ans += a[3*N - (i+1)*2]

print(ans)

Solution (Python):
n = int(input())
A = sorted(list(map(int, input().split())))
print(sum(A[n::2]))

Solution (Python):
N=int(input())
A=sorted(list(map(int,input().split())))[::-1]
ans=0
for i in range(1,2*N,2):
  ans+=A[i]
print(ans)

Solution (Python):
n=int(input())
a=sorted(list(map(int,input().split())))
a_mid=a[n::2]
print(sum(a_mid))

Solution (Python):
n,*a=map(int,open(0).read().split())
a.sort()
print(sum(i for i in a[-2:n-1:-2]))

Solution (Python):
N = int(input())
strengths = map(int, input().split())
sorted_strengths = sorted(strengths, reverse=True)

team_strength_sum = 0
for i in range(3*N):
    if ((i+1)%2 == 0) & ((i+1)//2 <= N):
        team_strength_sum += sorted_strengths[i]
print(team_strength_sum)

Solution (Python):


N = int(input().split()[0])
a_list = list(map(int, input().split()))
a_list = sorted(a_list, reverse=True)


x_list = a_list[: 2 * N]
ans = sum([x for i, x in enumerate(x_list) if i % 2 == 1])

print(ans)

Solution (Python):
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7



N = int(sys.stdin.buffer.readline())
A = list(map(int, sys.stdin.buffer.readline().split()))

A.sort(reverse=True)
print(sum(A[1:2*N:2]))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(N, 3 * N, 2):
    ans += a[i]

print(ans)

Solution (Python):
def main():
  N = int(input())
  a = list(map(lambda i: int(i), input().split(' ')))
  a.sort()
  a.reverse()
  max_point = 0
  for i in range(0, 2 * N):
    if i % 2 == 1:
      max_point += a[i]
  print(max_point)

main()

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
ans = 0
li.sort()
cnt = 0
for i in range(n*3-2,-1,-2):
    if cnt == n:
        break
    
    ans += li[i]
    cnt += 1
    
print(ans)

Solution (Python):
n = int(input())
members = [int(x) for x in input().split()]
members.sort(reverse=True)
strongness = 0
for i in range(n):
    strongness += members[2*i+1]
print(strongness)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)

b = a[1::2]

print(sum(b[:N]))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()
print(sum(a[N::2]))

Solution (Python):

def main():
    N = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    ans = 0
    for i in range(N):
        ans += a[2 * i + 1]
    print(ans)
if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()

a_li=a[1:2*n:2]
print(sum(a_li))

Solution (Python):


N=int(input())
A=list(map(int,input().split()))
A.sort()

count=0
for _ in range(N):
    A.pop(-1)
    count+=A.pop(-1)
print(count)

Solution (Python):
N = int(input())
a = [int(i) for i in input().split()]
s_sort = sorted(a, reverse=True)
score = 0
for i in range(1, 2*N, 2):
    score += s_sort[i]
print(score)

Solution (Python):
n = int(input())
li =  sorted(list(map(int,input().split())) , reverse=True)
count = 0
k = 1
for i in range(n):
    count += li[k]
    k += 2

print(count)

Solution (Python):
def main():
    n = int(input())
    a = list(map(int, input().split()))

    a.sort()

    ans = 0
    for e in a[-2:n-1:-2]:
        ans += e

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
a=sorted(map(int,input().split()))
print(sum(a[n::2]))

Solution (Python):
n = int(input())

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

a.sort()

ans = 0

for i in range(n, 3 * n, 2):
    ans += a[i]

print(ans)

Solution (Python):
N = int(input())
a_list = list(map(int, input().split()))

a_list.sort()

target_total = 0
for j in range(N, 3 * N, 2):
    target_total += a_list[j]

print(target_total)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=0
for i in range(N):
  ans+=A[N*3-2-i*2]
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a=sorted(a,reverse=True)
print(sum(a[1:2*n:2]))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a.sort(reverse = True)
sum = 0
for i in range(n):
    sum += a[i * 2 + 1]
print(sum)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
for i in range(0,2*n):
    if i%2!=0:
        ans+=a[i]

print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0

for i in range(n):
    
    ans += a[n+2*i]
print(ans)

Solution (Python):
from collections import Counter,defaultdict,deque
import sys,bisect,math,itertools,string,queue
from heapq import heappop, heappush
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
a.sort()
res = 0
ind = n
for i in range(n):
    if i == 0:
        res += a[ind]
        continue
    ind += 2
    res += a[ind]
print(res)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(sum(a[n::2]))

Solution (Python):
n=int(input())
a=list(map(lambda x: int(x), input().split()))
a.sort(reverse=True)
print(sum(a[1:2*n:2]))

Solution (Python):
n = int(input())
A = sorted(list(map(int, input().split())))[n:]

ans = 0
for i in range(0, 2*n, 2):
    ans += A[i]

print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
ans = 0
count = 0
for i in range(1, N*3+1, 2):
    if count == N:
        break
    else:
        ans += a[i]
        count += 1

print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()

print(sum(a[N::2]))

Solution (Python):
N = int(input())
S = input().split()
for i in range(0, 3*N):
  S[i] = int(S[i])
S = sorted(S, reverse = 1)
answer = 0
for i in range(0, N):
  answer += S[2*i+1]
print(answer)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))

ans = 0
A.sort(reverse=True)
for i in range(1, 2*n+1, 2):
    ans += A[i]
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()
ret = 0
for n in range(N, N*3, 2):
    ret += A[n]
print(ret)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
ans = 0
j = 3*n-n
for i in range(j):
  if i%2!=0:
    ans += a[i]
print(ans)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))	
a.sort(reverse=True)
s=0
for i in range(n):
    s+=a[1+i*2]
print(s)

Solution (Python):
N = int(input())
a = sorted(list(map(int, input().split())),reverse=True)
x = 0

for i in range(N):
    x += a[2*i+1]
print(x)

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort(reverse=True)
    print(sum(a[1:n*2:2]))


if __name__ == '__main__':
    slove()

Solution (Python):
N = int(input())
a = [i for i in map(int, input().split())]

a.sort(reverse=True)
print(sum(a[1:2*N:2]))

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort(reverse=True)
    t = 0
    for i in range(1, 2 * n, 2):
        t += a[i]
    print(t)


if __name__ == '__main__':
    slove()

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
a.sort()
b=a[N::2]
print(sum(b))

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())))
print(sum(a[n::2]))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort()

ans = 0
for a in A[N:: 2]:
    ans += a

print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = sum([v for i, v in enumerate(A) if i % 2 == 1 and i <= 2 * N])
print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = a[:-n]
ans = sum(b[1::2])
print(ans)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
A=A[:-1*N]
print(sum(A[1::2]))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=sum(a[n::2])
print(ans)

Solution (Python):
def solve(n, a):
    return sum(sorted(a)[::-1][1:2*n:2])

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))

Solution (Python):
N = int(input())
a = list(map(int,input().split()))

a.sort(reverse=True)

a = a[:2*N]


print(sum(a[1::2]))

Solution (Python):
n = int(input())
List = list(map(int, input().split()))
List = sorted(List)
print(sum(List[n::2]))

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
sum = 0
if N == 1:
  print(sum)
else:
  for i in range(2*N):
    if i%2 != 0:
      sum += a[i]
  print(sum)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))

A.sort(reverse=True)

print(sum(A[1:2*N:2]))

Solution (Python):
def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    ans = 0
    for i in range(n):
        ans += a[2 * i + 1]
    print(ans)


if __name__ == "__main__":
    resolve()

Solution (Python):
n = int(input())
a = sorted(list(map(int, input().split())))
print(sum(a[n::2]))

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort(reverse=True)
    ans = []
    for i in range(1, n * 3, 2):
        ans.append(a[i])
        if len(ans) == n:
            print(sum(ans))
            exit()


if __name__ == '__main__':
    slove()

Solution (Python):

def main():
    
    
    N, *A = map(int, open(0).read().split())
    A.sort()
    ans = sum(A[N::2])
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
a = sorted(list(map(int,input().split())))
a = a[N::2]
print(sum(a))

Solution (Python):
N,*A=map(int,open(0).read().split());A.sort();print(sum(A[N::2]))

Solution (Python):
n = int(input())
a = input().split()
a = [int(i) for i in a]
a = sorted(a)
 
candidate = a[n:len(a)+1]
print(sum([candidate[i] for i in range(0, 2*n, 2)]))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = int(0)


ans = sum(a[n:3*n:2])
print(ans)

Solution (Python):
N = int(input())
As = list(map(int, input().split()))
As.sort()
r = sum(As[N::2])
print(r)

Solution (Python):
import sys
input=sys.stdin.readline
import collections

def main():
    _ = int(input())
    A = list(map(int, input().split()))
    A.sort()
    q = collections.deque(A)
    ans = 0
    while q:
        q.popleft()
        q.pop()
        ans += q.pop()
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
print(sum(a[1::2][:N]))

Solution (Python):
N = int(input())
a = sorted([int(x) for x in input().split()], reverse=True)
print(sum(a[i] for i in range(1,2*N+1,2)))

Solution (Python):
N = int(input())
a3N = list(map(int, input().split()))

a3N.sort(reverse = True)
sumn = 0
for i in range(N):
  sumn += a3N[2*i+1]

print(sumn)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
sorted_A = sorted(A)
print(sum(sorted_A[N:3*N:2]))

Solution (Python):
n = int(input())
array = list(map(int, input().split()))

array = sorted(array, reverse=True)
print(sum(array[1:2 * n:2]))

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
a = sorted(A,reverse=True)
ans = []
for i in range(1,2*n+1,2):
         ans.append(a[i])
print(sum(ans))

Solution (Python):
N=int(input());print(sum(sorted(map(int,input().split()))[N::2]))

Solution (Python):
N=int(input())
print(sum(sorted(map(int,input().split()))[N::2]))

Solution (Python):
N=int(input())
*A, = map(int,input().split())
print(sum(sorted(A)[N::2]))

Solution (Python):
N = int(input())
a = list(map(int,input().split()))
a.sort(reverse = True)
x = 0

for i in range(N):
    x += a[2 * i + 1]
print(x)

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
for i in range(N):
    ans+=a[2*i+1]
print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

a.sort(reverse=True)
print(sum(a[1:2 * N:2]))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a.sort()
print(sum(i for i in a[n::2]))

Solution (Python):
N = int(input())

a_s = input().split()

for i in range(3*N):
  a_s[i] = int(a_s[i])
  
a_s = sorted(a_s)

a_1 = a_s[:N]
a_2 = a_s[N:]

ans = sum(a_2[0::2])

print(ans)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()
score = 0

for i in range(N, N*3, 2):
    score += a[i]

print(score)

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
a.sort()
score = 0

for i in range(N, N*3, 2):
    score += a[i]

print(score)

Solution (Python):
N=int(input())
aList=sorted(list(map(int,input().split())))[::-1]
print(sum(aList[1:2*N:2]))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
from collections import deque
a=deque(a)
ans=0
for i in range(n):
    d=a.pop()
    ans+=a.pop()
    d=a.popleft()
print(ans)

Solution (Python):
N = int(input())
A = sorted(list(map(int, input().split())), reverse = True)
ans = 0
for i in range(N):
  ans += A[2*i+1]
print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
for i in range(n):
	ans+=a[-i*2-2]
print(ans)

Solution (Python):
n = int(input())
arr = list(map(int, input().split(" ")))
arr.sort()


new_arr = arr[n::2]
print(sum(new_arr))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

A.sort()
ans = 0

for i in range(N, 3*N, 2):
    ans += A[i]
    
print(ans)

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    a = list(map(int, input().split()))
    a.sort()
    a_new = a[N:N * 3:2]
    total = sum(a_new)
    print(total)

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
total = 0
for i in range(n, 3*n, 2):
    total += arr[i]
print(total)

Solution (Python):
n=int(input())
A=list(map(int,input().split()))

A.sort()
ans=0
for i in range(n,3*n,2):
  ans+=A[i]
print(ans)

Solution (Python):
import sys
N=int(sys.stdin.readline())
l = [int(i) for i in sys.stdin.readline().split()]
l.sort()
print(sum(l[N::2]))

Solution (Python):
import sys
N=int(sys.stdin.readline())
l = list(map(int,sys.stdin.readline().split()))
l.sort()
print(sum(l[N::2]))

Solution (Python):
import sys
N=int(sys.stdin.readline())
l = list(map(int,sys.stdin.readline().split()))
l.sort()
print(sum(l[N::2]))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
ans=0
for i in range(N,3*N,2):
  ans+=A[i]
print(ans)

Solution (Python):
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    a.sort(reverse=True)
    print(sum(a[1:2*n+1:2]))


if __name__ == '__main__':
    slove()

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    n = I()
    a = LI()
    a.sort(key = lambda x:-x)
    ans = 0
    for i in range(n):
        ans += a[2*i+1]
    print(ans)
    return


def B():
    def dfs(d,x,c):
        if d <= dp[x]:
            return
        dp[x] = d
        if not f[x]:
            f[x] = c
        for y in v[x]:
            dfs(d-1,y,c)
    n,m = LI()
    f = [0]*n
    v = [[] for i in range(n)]
    for i in range(m):
        a,b = LI()
        a -= 1
        b -= 1
        v[a].append(b)
        v[b].append(a)
    dp = defaultdict(lambda : -1)
    q = I()
    l = LIR(q)
    l = l[::-1]
    for x,d,c in l:
        x -= 1
        dfs(d,x,c)
    for i in f:
        print(i)
    return


def C():
    n = I()

    return


def D():
    n = I()

    return


def E():
    n = I()

    return


def F():
    n = I()

    return


if __name__ == "__main__":
    A()

Solution (Python):

N = int(input())
A = list(map(int, input().split()))
i = 1
ans = 0
A.sort(reverse=True)

while i <= 2*N:
    ans = ans + A[i]
    i += 2

print(ans)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = 0
for i in range(3*n):
  if i >= n and (i-n) % 2 == 0:
    ans += a[i]
print(ans)

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    tot = 0
    for i in range(N):
        tot += A[3*N-2-2*i]
    return tot
if __name__ == '__main__':
    print(main())

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    tot = 0
    for i in range(N):
        tot += A[3*N-2-2*i]
    return tot
if __name__ == '__main__':
    print(main())

Solution (Python):
N=int(input())
a=sorted(list(map(int,input().split())))
print(sum(a[N::2]))