let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let as_ = Array.init (3 * n) (fun _ -> Scanf.scanf "%d " (fun n -> n)) in
  Array.sort (fun x y -> compare y x) as_;
  Printf.printf "%d\n" (Array.fold_left ( + ) 0 (Array.init n (fun i -> as_.(2 * i + 1))))