open Batteries
open Printf
let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let l_lst = Array.to_list @@ Array.init (n*2) (fun _ -> Scanf.scanf "%d " (fun a -> a)) in
  let len = List.length l_lst in
  List.sort compare l_lst |> 
  List.filteri (fun i x -> i mod 2 = 0 && i <> len-1) |>
  List.fold_left (+) 0 |>
  Printf.printf "%d\n" 
  



