object Main extends App {
  import scala.io.StdIn._
  val n = readInt
  val sticks = readLine.trim.split(' ').map(_.toInt).sorted
  println((0 until n).map(i ⇒ (i + 1 until n).map(j ⇒ (j + 1 until n).count(k ⇒ sticks(i) + sticks(j) > sticks(k))).sum).sum)
}
