object Main extends App {
 val n = readInt
 val input = readLine.split(" ").map(_.toInt).sorted
 var ans = 0
 def count(l:Array[Int],k:Int, ans:Int, ab:Int):Int = {

   if(l.length <= k)
     ans
   else if(l(k) >= ab)
     ans
   else
     count(l, k + 1, ans + 1, ab)
 }  
   
 for(i <- 0 until n) {
   for(j <- i + 1 until n) {
     var ab = input(i) + input(j)
     ans = count(input,j + 1, ans, ab)
   }
 }
  println(ans)  
}
