#include<bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
  int i,j;ll cnt=0;
  ll n;
  cin>>n;
  ll a[3*n];
  for(i=0;i<3*n;i++)cin>>a[i];
  sort(a,a+3*n,greater<ll>());
  for(i=0;i<n;i++)cnt+=a[2*i+1];
  cout<<cnt<<endl;
}