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):
N = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
num = 0
for i in range(1, 2 * N + 1):
    if i % 2 == 1:
        num += a[i]

print(num)

Solution (Python):


import sys
import collections

n= int(input())
tmp = input().split()
a = list(map(lambda a: int(a), tmp))


a.sort()


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

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Solution (Python):
import sys
N = int(sys.stdin.readline().rstrip())
a = sorted(list(map(int, sys.stdin.readline().rstrip().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(reverse = True)
ans = 0
for i in range(N*2):
  if i % 2 != 0:
    ans += a[i]
  else:
    pass
  
print(ans)

Solution (Python):
n = int(input())
array = [int(i) for i in input().split()]

list.sort(array, reverse=True)
ans = 0



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

Solution (Python):
N = int(input())
val = [int(i) for i in input().split()]
val.sort(reverse=True)
sum = 0 
for i in range(N):
    sum += val[2*i+1]
print(sum)

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

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

a = input().split()
for i in range(3*n):
	a[i] = int(a[i])

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

Solution (Python):

import sys, math, fractions, itertools, collections, copy, heapq


def solve(N: int, a: "List[int]"):
    a = sorted(a, reverse=True)
    print(sum(a[:2*N][1::2]))
    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
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

def main(): 
    N = II()
    a_li = LI()  

    a_li.sort()

    a_li = a_li[N::2]
    print(sum(a_li))


    



main()

Solution (Python):


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

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(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()) * 3
A = sorted([int(_) for _ in input().split()])
ans = 0

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

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

Solution (Python):
member = int(input())
member_array = sorted(list(map(int, input().split())),reverse=True)
result = 0
count = 1

for i in range(member):
    result += member_array[count]
    count += 2

print(result)

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())
l=list(map(int,input().split()))
l=sorted(l,key=lambda x:x,reverse=True)
s=0
ind=1
while True:
  s+=l[ind]
  ind+=2
  if ind>2*n:
    break
print(s)

Solution (Python):
N = int(input())
li = list(map(int,input().split()))
li.sort(reverse = True)
total = []
for i in li[1:2 * N:2]:
  total.append(i)
print(sum(total))

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

Solution (Python):
n,*a=map(int,open(0).read().split());print(sum(sorted(a)[n::2]))

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

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

Solution (Python):



N = int(input())
a = sorted(list(map(int, input().split())), reverse = True)
array = []
for i in range(1, 2 * N, 2):
    array.append(a[i])
print(sum(array))

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

result = 0
for j in range(teams):
    result += strongs[1+j*2]

print(result)

Solution (Python):
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
print(sum(A[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(n):
    ans += a[2*i+1]
print(ans)

Solution (Python):
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
except_weak = a_list[n:]

ans = sum(except_weak[::2])
print(ans)

Solution (Python):
n = int(input())
players_powers = sorted(list(map(int, input().rstrip("\n").split())), reverse=True)

print(sum(players_powers[1::2][:n]))

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

N = int(input())
A = [int(x) for x in input().split()]
A.sort()
answer = sum(A[N::2])
print(answer)

Solution (Python):


n=int(input())
a=sorted(list(map(int,input().split())))
r=3*n-1
cnt=0
for l in range(n):
    cnt+=a[r-1]
    r-=2
print(cnt)

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

a_sort = sorted(a, reverse=True)

print(sum(a_sort[1:2*N: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())
arr = list(sorted(list(map(int, input().split())), reverse=True))
arr = arr[1::2]
arr = arr[:n]
print(sum(arr))

Solution (Python):
n = int(input())
n1= n * 3
arr = sorted(list(map(int,input().split())))
sums = 0
count = 0
for i in range(-1,-n1,-2):
  sums += arr[i-1]
  count += 1
  if count == n:
    print(sums)
    break

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

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

Solution (Python):
import copy

N = int(input())
a = list(map(int, input().split()))
a.sort()
b = copy.deepcopy(a[N:])

sums = 0
for i in range(0, 2*N, 2):
    sums += b[i]

print(sums)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 0
index = 3*N-1
i = 0
while i < N:
    ans += A[index-1]
    index -= 2
    i += 1
print(str(ans))

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

Solution (Python):

def main():
    n = int(input())
    A = sorted(map(int, input().rstrip().split()))
    print(sum(A[n::2]))


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    n = int(input())
    A = sorted(map(int, input().rstrip().split()))[n:]
    print(sum(A[::2]))


if __name__ == "__main__":
    main()

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

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

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

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


if __name__ == "__main__":
    main()

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


a.sort(reverse=True)

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

print(count)

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

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

def main():
    N = int(input())
    a = sorted(list(map(int, input().split())), reverse=True)

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

if __name__ == "__main__":
    main()

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

print(sum(aa[1:2*n: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())
A = list(map(int,input().split()))
A.sort()
print(sum(A[3*N-2:N-1:-2]))

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

total = 0
res = 1
for i in range(n):
    total += ls[res]
    res += 2
print(total)

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

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

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

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

Solution (Python):
from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
data = sorted(data)
data = list(reversed(data))
ans = data[:2*N][1::2]
print(sum(ans))

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

a_sorted = sorted(a_list, reverse=True)
sum_a = 0
for i in range(n):
    sum_a += a_sorted[i * 2 + 1]

print(sum_a)

Solution (Python):
import numpy as np

n = int(input())

arr = list(map(int,input().split()))
arr.sort()
arr = arr[::-1]


s = 0

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

print(s)

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

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

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

Solution (Python):



def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, typ=int):
    return [typ(input()) for _ in range(n)]


def main():
    n, = read_h()
    a = sorted(read_h(), reverse=True)

    print(sum([ai for i, ai in enumerate(a[:2 * n]) if i % 2 == 1]))


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(1,n+1):
    ans = ans+a[i*2-1]
print(ans)

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


if __name__ == '__main__':
    n = int(input())
    print(solve(n))

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

Solution (Python):
N = int(input())
row = input().split()
a = list(map(int, row))
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()
print(sum(a[n::2]))

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

print(ans)

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

print(ans)

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

print(ans)

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

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

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

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

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

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

a.sort(reverse=1)
out = (a[1:2*n:2])
print(sum(out))

Solution (Python):

n = int(input())
num_list = sorted([ int(v) for v in input().split() ])
print(sum(num_list[n:][::2]))

Solution (Python):
from fractions import gcd
def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



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

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

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

Solution (Python):
print(sum(sorted(list([float(None==exec("N=int(input())"))] + list(map(int, input().split()))), reverse=True,key=lambda x: 10 ** 10 if type(x) == float else x)[2:2*N+1:2]))

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

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

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

Solution (Python):
import sys
import numpy as np


def main():
    n = int(input())
    an = [int(e) for e in input().split()]
    astrong = sorted(an)[n:]
    ans = sum(astrong[i] for i in range(0, n * 2, 2))
    print(ans)


main()

Solution (Python):
N = int(input())
li = [int(x) for x in input().split()]
li.sort()
ans = sum([li[N+x*2] for x in range(N)])
print(ans)

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

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

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

list = input().split(" ")
num_list = []

for num in list:
    num_list.append(int(num))

num_list.sort(reverse=True)
total = 0
count = 0
for i in range(N*3):
    if i % 2 == 1 and count < N:
        total += num_list[i]
        count += 1
        
print(total)

Solution (Python):

N = int(raw_input())
a_arr = map(int, raw_input().split())

a_arr_sort = sorted(a_arr, reverse=True)

sum_val = 0
for idx in range(0, N):
  temp_val = a_arr_sort[2*idx+1]
  sum_val += temp_val

print(sum_val)

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

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

S_A = sorted(A)[::-1]

print(sum(S_A[1:2 * N + 1:2]))

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
list.sort(li,reverse = True)
total = 0
switch = 0
for i in range(2*n):
    if switch == 0:
        switch += 1
    elif switch == 1:
        switch -= 1
        total += li[i]
print(total)

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

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

Solution (Python):
n,a=int(input()),sorted(list(map(int,input().split())))[::-1];print(sum([a[i]*(i%2==1)for i in range(2*n)]))

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

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

Solution (Python):
N = input()
N =int(N)
nums= list(map(int,input().split(" ")))
nums.sort()
ans = 0

for _ in  range(N):
    nums.pop()
    ans += nums.pop()
print(ans)

Solution (Python):
teams = int(input())
people = list(map(int, input().split()))
people.sort(reverse = True)
sum = 0
for i in range(0,teams):
    sum = sum + people[(2*i) + 1]

print(sum)

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

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

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

sort_a = sorted(a, reverse=True)

sum_team = 0
for i in range(1, 2 * N + 1 ,2):
    sum_team += sort_a[i]

print(sum_team)

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

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

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

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

a = list(map(int, sys.stdin.readline().split()))

sorted_a = sorted(a)
reversed_a = sorted(a, reverse=True)

aa = []
for i in range(n):
    sorted_a.pop(-1)
    reversed_a.pop(-1)
    aa.append(sorted_a.pop(-1))

print(sum(aa))

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

print(sum([A[-i*2-2] for i in range(N)]))

Solution (Python):
n=int(input())
a=[int(x) for x in input().split()]
a.sort(reverse=1)

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

Solution (Python):

"""
A - AtCoder Group Contest
https://atcoder.jp/contests/agc012/tasks/agc012_a

"""
import sys


def solve(N, array):
    array.sort(reverse=True)
    ans = 0
    for i in range(1, 2*N, 2):
        ans += array[i]
    return ans


def main(args):
    N = int(input())
    array = [int(a) for a in input().split()]
    ans = solve(N, array)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

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

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)-1]
  
print(ans)

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

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

Solution (Python):
N=int(input())
A=[int(i) for i in input().split()]
A.sort(reverse=True)
print(sum(A[1:2*N:2]))

Solution (Python):

n = int(input())
a = [int(i) for i in 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())
print(sum(sorted(list(map(int,input().split(' '))))[N::2]))

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

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

print(ans)

Solution (Python):
n=int(input())
a=sorted([int(i) for i in input().split()])[::-1]
print(sum(a[1:2*n:2]))

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

s = 0
i = N
while i < 3 * N:
    s += a[i]
    i += 2

print(s)

Solution (Python):
n = int(input())
numbers = [int(x) for x in input().split()]

numbers.sort(reverse=True)
ans = 0
order = 1
for j in range(1, n+1):
  ans+=numbers[order]
  order+=2
  
print(ans)

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

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

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

Solution (Python):


n = int(input())
numbers = [int(_) for _ in input().split()]
    
numbers.sort(reverse=True)
ans = 0
order = 1
for j in range(1, n+1):
    ans += numbers[order]
    order += 2
    
print(ans)

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

Solution (Python):
n=int(input())
print(sum(sorted([int(i) for i in input().split()])[-2:n-1:-2]))

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

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

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

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()
ans = 0
i = n
while i <= 3*n-1:
    ans += a[i]
    i +=2
print(ans)

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

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

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

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

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

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

print(sum(sorted(A, reverse=True)[:2*N][1::2]))

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    alist = [int(i) for i in input().split()]
    alist.sort(reverse=True)
    st = 0
    for i in range(n):
        st += alist[2*i+1]
    print(st)

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

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

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

Solution (Python):
N=int(input())
A=[int(i) for i in 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 = sorted(A, reverse=True)

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

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

Solution (Python):
N = int(input())
list = [int(i) for i in input().split()]
list.sort()
result = 0
for i in list[::-1][1::2][:N]:
  result += i
print(result)

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

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

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

Solution (Python):
n=int(input())
a=sorted([int(i) for i in input().split()])[::-1]
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(reverse=True)
print(sum(A[1::2][:N]))

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

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

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()
print(sum(a[n::2]))

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

print(sum(l[1:2*n:2]))

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
     
A.sort(reverse = True)
B = A[1::2]
c = 0

for i in range(N):
  c += B[i]

print(c)

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

san = sorted(an)
print(sum(san[i] for i in range(N, N*3, 2)))

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

print(sum(ans[:N]))

Solution (Python):
import numpy as np
import math
import fractions

class KyoPro:
    @staticmethod
    def ReadNumbers():
        return list(map(int, input().split()))

    @staticmethod
    def MakeStringFromNumbers(a):
        if len(a) == 0:
            return
        s = str(a[0])

        for i in range(1, len(a)):
            s += ' ' + str(a[i])
        
        return s

def main():
    n = int(input())
    a = KyoPro.ReadNumbers()

    a.sort()
    a.reverse()

    count = 0
    ans = 0
    for i in range(3 * n):
        if(i % 2 == 1):
            ans += a[i]
            count += 1
        if(count == n):
            break
    
    print(ans)

    

main()

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

Solution (Python):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
A.sort(kind='mergesort')
out = 0
for k in range(N):
  out += A[-2*(k+1)]
print(out)

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l.sort()
power = 0
for i in range(1,len(l)//3+1):
    power += l[-2*i]
print(power)

Solution (Python):
n =int(input())
s = input()
data = []
for it in s.split():
    data.append(int(it))
data.sort()

rest = data[n:]
print(sum(rest[::2]))

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

a = list(sorted(a, reverse=True))
print(sum(a[1:2 * N:2]))

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

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

Solution (Python):
n,*a=map(int,open(0).read().split());print(sum(sorted(a)[n::2]))

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

Solution (Python):
n,*a=map(int,open(0).read().split());print(sum(sorted(a)[n:][::2]))

Solution (Python):
n,*a=map(int,open(0).read().split());print(sum(v for k,v in enumerate(sorted(a)[n:])if k%2<1))

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

a3n = sorted(a3n,reverse=True)

print(sum(a3n[1:2*n:2]))

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

A.sort(reverse=True)

ans = 0
for i in A[1:2*N:2]:
    ans += i

print(ans)

Solution (Python):
n = int(input())
A = sorted([int(i) for i in input().split()], reverse = True)
ans = 0
for i in range(n * 2):
    if i % 2 == 1:
        ans += A[i]
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 = sorted(list(map(int, input().split())))

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

Solution (Python):
def solve():
  n= int(input())
  a = list(int(i) for i in input().split())
  a.sort() 
  
  a = a[n::]
  
  ans = 0
  for i in range(2*n):    
   if i%2 == 0: ans += a[i]
  return ans
  
  
if __name__ == '__main__':
  print(solve())

Solution (Python):


import sys


INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    A = LI()
    A.sort()
    A.reverse()
    res = 0
    for i in range(n):
        res += A[1 + i * 2]

    return res


print(main())

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

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

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

A.sort()

res = 0
count = 0
for i in range(1, 3 * N):
    if i%2 == 0:
        res += A[-i]
        count += 1
        
    if count == N:
        break
    
print(res)

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

Solution (Python):

"""
Created on Fri Mar  1 00:32:34 2019

@author: yuta
"""

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

def main(n,a):
    b = sorted(a,reverse = True)
    c = b[:(2*n+1)]
    d = c[1::2]
    max_sum = sum(d)
    print(max_sum)
main(N,a)

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

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

print(sum(xx))

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

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

Solution (Python):
import sys
input=sys.stdin.readline
n=int(input())
A=list(map(int,input().split()))
A.sort()
print(sum(A[-2:-2*n-1:-2]))