function Main(input) {
  input = input.split("\n");
  const n = parseInt(input[0], 10);
  const ls = input[1].split(" ").map((l) => parseInt(l, 10));
  ls.sort((a, b) => a - b);
  let count = 0;
  for (let i=0; i<n; i++) {
    const li = ls[i];
    outer: for (let j=i+1; j<n; j++) {
      const lj = ls[j];
      if (li === lj) continue;
      for (let k=j+1; k<n; k++) {
        const lk = ls[k];
        if (lj === lk) continue;
        if (li + lj <= lk) continue outer;
        count++;
      }
    }
  }
  console.log(count);
}

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