import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val a = (1.. 3 * n).map { sc.nextLong() }.toLongArray()

  val aa = a.sorted()
  val ans = mutableListOf<Long>()

  var case1 = 0L
  for (i in 0 until n) {
    case1 += aa[i + n]
  }
  ans.add(case1)

  var case2 = aa[n - 2]
  ans.add(case2)

  var case3 = 0L
  for (i in 0 until n) {
    val index = (3 * n - 1) - (2 * i + 1)
    case3 += aa[index]
  }
  ans.add(case3)

  println(ans.max())
}