object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N = sc.nextInt()
  val participants = List.fill(3 * N)(sc.nextLong())
  println(participants.sorted(Ordering[Long].reverse).slice(N, 2 * N).sum)
}
