function Main(input) {
  input = input.split("\n");
  var N = input[0];
  var L = input[1].split(" ").map(Number);
  L.sort(function(a,b){return b-a;});
  var sum = 0;
  for(var i=0;i<N-2;i++){
    for(var j=i+1;j<N-1;j++){
              var tag = L[i]-L[j];
      for(var k=j+1;k<N;k++){
        if(tag>=L[k]){
        break;
        }else{
        sum++;
        }
        
      }
    }
  }
  console.log(sum);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));