function Main(input) {
  input = input.split("\n");
  var N = input[0];
  var L = input[1].split(" ").map(Number);
  var sum = 0;
  for(var i=0;i<N-2;i++){
    for(var j=i+1;j<N-1;j++){
      for(var k=j+1;k<N;k++){
        var Lsum = L[i]+L[j]+L[k];
        var ma = Math.max(L[i],L[j],L[k]);
        var lo = Lsum-ma;
        if(lo>ma){
          sum++;
        }
        
      }
    }
  }
  console.log(sum);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));