let n = (Scanf.scanf "%d " (fun x -> x));;
let xs =
    let rec loop i = 
        if i = 0
        then
            []
        else
            (Scanf.scanf "%d " (fun x -> x)) :: (loop (i-1))
    in
            List.sort compare (loop (n*2));;


let solve () = 
    let rec loop ls = 
        match ls with
        |a::b::z -> (begin a + (loop z) end )
        |_ -> 0
    in
        loop xs;;
        

Printf.printf "%d\n" (solve ())