import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val n  = sc.nextInt
  val sl = Vector.fill(n)(sc.nextInt)

  val acc = Samples.comulativeSum(sl.sortWith(_ > _)).reverse
  val res = acc.find(_ % 10 != 0).getOrElse(0)

  println(res)
}