function Main(input) {
  input = input.split("\n");
  var length = input[1].split(" ");
  var count = 0;
  
  function compare(a, b) {
    return a - b;
  }

  length.sort(compare);
  
  for(i = 0; i < input[0]; i++){
  	for(j = (i+1); j < input[0]; j++){
    	for(k = (j+1); k < input[0]; k++){
        	if(length[i] != length[j] && length[j] != length[k] && length[k] != length[i]){
            	if((parseInt(length[i], 10) + parseInt(length[j], 10)) > length[k]){
                	count++;
                }
            }
        }
    }
  }
  
  console.log(count);
}

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