fun main() {
    val n = readLine()!!.toInt()
    val ls = readLine()!!.split(' ').map { it.toInt() }.sorted()
    var ans = 0

    for (i in 2..n - 1)
        for (j in 1..i - 1)
            for (k in 0..j - 1) {
                if (ls[k] + ls[j] > ls[i] && ls[k] != ls[j] && ls[k] != ls[i] && ls[j] != ls[i]) {
                    ans++
                }
            }

    println(ans)
}
