import Utils.Helper

object Main {
  def main(args: Array[String]): Unit = {
    println(
      confirm(
        isHaiku(readToListInts)
      )
    )
  }

  def isHaiku(list: List[Int]) : Boolean =
    list.count(n => n == 5) == 2 && list.count(n => n == 7) == 1

  def isHaiku2(list: List[Int]) : Boolean = {
    val group = list.groupBy(c => c)
    val fives = group.getOrElse(5, List()).length
    val sevens = group.getOrElse(7, List()).length
    fives == 2 && sevens == 1
  }

  def confirm(isHaiku: Boolean): String = if (isHaiku) "YES" else "NO"
  
  def readToListInts: List[Int] = readLine.split(" ").map(_.toInt).toList
}




