const main = stdin => {
  const input = stdin.trim().split('\n')
  const N = parseInt(input[0])
  const lines = input[1].trim().split(' ').map(x => parseInt(x))

  let count = 0
  for (let i = 0; i < N; i++) {
    for (let j = i + 1; j < N; j++) {
      for (let k = j + 1; k < N; k++) {
        if (lines[i] !== lines[j] && lines[i] !== lines[k] && lines[j] !== lines[k]) {
          if (lines[i] + lines[j] > lines[k] && lines[j] + lines[k] > lines[i] && lines[k] + lines[i] > lines[j]) {
            count++
          }
        }
      }
    }
  }

  console.log(count)
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
