function main(input){
  var num = 0;//合計
  var i = 0;//１本目カウンタ
  var counter = 1;//２本目カウンタ
  var thcount = 2;//３本目カウンタ
  var inputN;
  var inputD;
  input = input.split('\n');
  inputN = parseInt(input[0]);
  inputD =  input[1].split(' ');

  for(i=0;i<inputN-2;i++){
    for(counter=i+1;counter<inputN-1;counter++){
      for(thcount=counter+1;thcount<inputN;thcount++){
        if(i!=counter && i != thcount && counter!=thcount){
          if(parseInt(inputD[i])<parseInt(inputD[counter]) + parseInt(inputD[thcount]) && parseInt(inputD[counter])<parseInt(inputD[thcount]) + parseInt(inputD[i]) && parseInt(inputD[thcount]) < parseInt(inputD[i]) + parseInt(inputD[counter])){
            num++;
          }
        }
      }
    }
  }
  console.log(num);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));