object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt()
    val L = Array.fill(N)(sc.nextInt()).sorted(Ordering.Int.reverse)

    val c = for {
      a <- (0 until N - 2)
      b <- (a + 1 until N - 1)
      c <- (b + 1 until N)
      if L(c) > L(a) - L(b)
    } yield ()

    println(c.size)
  }

}
