import Control.Monad

merge xs [] = xs
merge [] ys = ys
merge (x:xs) (y:ys)
    | x < y     = x : merge xs (y:ys)
    | otherwise = y : merge (x:xs) ys

sort [x] = [x]
sort x = merge (sort (take h x)) (sort (drop h x))
    where
        h = length x `div` 2
{-
getAns :: Int -> [Int] -> Int
getAns n [] = 0
getAns n (x:xs)
  | sum xs `mod` 10 == 0 = getAns n xs
  | otherwise            = sum xs
-}
g n [] = n
g n (x:xs)
  | x `mod` 10 == 0 = g n xs
  | otherwise       = x

main = do
  num <- read <$> getLine
  nums <- replicateM num $ read <$> getLine
  let newNums = sort nums
  putStrLn $ show (if sum newNums `mod` 10 == 0 then sum newNums - g (sum newNums) newNums
                                                else sum newNums)
