price :: [Int] -> Int
price = iter 0 [] where
    iter m l [] = div m 2 + sum l
    iter m l (x:xs)
        | x > m     = iter x (m:l) xs
        | otherwise = iter m (x:l) xs

readData :: Int -> IO [Int]
readData 0 = return []
readData n = do
    x <- readLn :: IO Int 
    fmap (x:) $ readData (n-1)
        
main :: IO() 
main = do
    n <- readLn :: IO Int
    l <- readData n
    let ans = price l 
    print ans
    