function main(lines) {
  const N = +lines[0];
  const ls = splitN(lines[1]);
  
  let ans = 0;
  for (let i = 0; i < N; i++) {
    for (let j = i+1; j < N; j++) {
      for (let k = j+1; k < N; k++) {
        const a = ls[i], b = ls[j], c = ls[k];
        if (a != b && b != c && c != a
          && a+b > c && b+c > a && c+a > b)
          ans++;
      }
    }
  }
  
  return ans;
}


const ans = main( require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n") );
console.log( ans );

function splitN(s) {
  return s.split(' ').map(Number);
}
