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 = comulativeSum(sl.sortWith(_ > _)).reverse
  val res = acc.find(_ % 10 != 0).getOrElse(0)

  println(res)


  def comulativeSum(intVector: Vector[Int]): Vector[Int] ={
    intVector.foldLeft(Vector.empty[Int]){
      case (list, acc) =>
        if(list.isEmpty) Vector(acc)
        else list :+ (list.last + acc)
    }
  }
}