function Main(arg) {
  let N = arg.trim().split('\n')[0];
  let Ln = arg.trim().split('\n')[1].split(' ');
  
  //sort
  Ln.sort(function(a,b){
    if(Number(a)<Number(b))return -1;
    if(Number(a)>Number(b))return 1;
    return 0;
  });

  let count = 0;
  let triSet = new Set();
  for(let i = 0; i+2 <= N; i++ ){
    for(let j = i+1; j+1 <= N; j++){
      for(let k = j+1; k <= N; k++){
        if(isTriangle(Ln[i],Ln[j],Ln[k])){
          count++;
        }
      }
    }
  }
  console.log(count);
}

function isTriangle (a, b, c){
  let numA = Number(a);
  let numB = Number(b);
  let numC = Number(c);
  return numA + numB > numC 
    && numA + numC > numB
    && numB + numC > numA
    && numA != numB
    && numB != numC;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));