function Main(input) {
  input = input.split("\n");
  var N = input[0];
  var L = input[1].split(" ").map(Number);
  var sum = [];
  for(var i=0;i<N-1;i++){
    for(var j=i+1;j<N;j++){
sum.push(L[i]+L[j]);
      }
    }
    var M =0;
    for(var k=0;k<N;k++){
      for(var l =0;l<sum.length;l++){
        if(sum[k] < L[l]);
        M++;
      }
    }
  console.log(M/3);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));