object Main extends App {
 val n = readInt
 val input = readLine.split(" ").map(_.toInt).sorted
 var ans = 0
 for(i <- 0 until n) {
   for(j <- i + 1 until n) {
     var ab = input(i) + input(j)
     	for(k <- j + 1 until n) {
          if(input(k) < ab)
            ans += 1
        }
   }
 }
  println(ans)  
}
