import scala.collection.mutable.ListBuffer
import scala.io.StdIn

object Main extends App {
  StdIn.readLine()
  val l = StdIn.readLine().split(" ").map(_.toInt)
  var res = 0
  for (x <- l.indices){
    for(y <- x+1 until l.length){
      for(z <- y+1 until l.length){
        if(l(x) < l(y)+l(z) && l(y) < l(z)+l(x) && l(z) < l(x)+l(y)){
          res += 1
        }
      }
    }
  }
  println(res)
}
