object Main extends App {
    val garbage = scala.io.StdIn.readLine
    val branches = scala.io.StdIn.readLine.split(" ").map(_.toInt).toSeq

    val answer = branches.combinations(3).count { case Seq(a, b, c) =>
      a < b + c && b < c + a && c < a + b
    }

    println(answer)
}