let id x = x
let n = Scanf.scanf "%d\n" id
 
let array = Array.init n (fun _ -> Scanf.scanf "%d\n" id)
let l = Array.length array
let list' = Array.to_list array
let list = List.sort compare list'
  
let rec pl i =
  if i = l then 0 else
    (List.nth list i) + pl (i+1)

let max = pl 0
      
let rec func i =
  if i = l then 0 else
    if ((List.nth list i) mod 10) <> 0 then max - (List.nth list i) else
      func (i+1)

let ans = if max mod 10 <> 0 then max else func 0

let () =
  Printf.printf "%d\n" ans