object Main {
  def main(args: Array[String]) {
    val N = io.StdIn.readLine().toInt
    val L = io.StdIn.readLine().split(' ').map { _.toInt }
    val answer = L.combinations(3).count { combination =>
		val a = combination(0)      
        val b = combination(1)
        val c = combination(2)
        a < b + c && b < c + a && c < b + a
    }
    println(answer)
  }
}