#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<long long> A(3*N);
	for (auto& x : A) cin >> x;
	sort(A.rbegin(), A.rend());
	long long s = 0;
	for (int i = 0; i < N; ++ i) s += A[2*i+1];
	cout << s << endl;
}
