
let rec input n xs
    = if n = 0 then
          xs
      else
          let l = Scanf.scanf "%d " (fun l -> l) in
          input (n-1) (l :: xs)

let rec solve xs n res
    = if n <= 0 then
        Printf.printf "%d\n" res
      else
        solve xs (n-2) (res + (List.nth xs (n-1)))

let _ =
    let n = Scanf.scanf "%d " (fun n -> 2 * n) in
    let xs = input n [] in
    let xs = List.sort compare xs in
    let l = (List.length xs) - 1 in
    solve xs l 0
