fun main() {
    val n = readLine()!!.toInt()
    val arr = readLine()!!.split(" ").map { it.toInt() }.toIntArray()
    arr.sort()
    var count = 0
    for (i in arr.indices) {
        for (j in i + 1..arr.lastIndex) {
            for (k in j + 1..arr.lastIndex) {
                val a = arr[i]
                val b = arr[j]
                val c = arr[k]
                if (a != b && b != c && isValidTriangle(a, b, c)) {
                    count++
                }
            }
        }
    }
    println(count)
}

private fun isValidTriangle(a: Int, b: Int, c: Int): Boolean {
    return a - b < c && c < a + b
}