import Data.List
import qualified Data.ByteString.Char8 as C
import Data.Maybe
main = do
  n <- read <$> getLine
  as <- map (fst . fromJust . C.readInt) . C.words <$> C.getLine
  print $ sum $ take (2*n) $ zipWith (*) (cycle [0,1]) (reverse $ sort as)