fun main () {
    readLine()!!.toInt()
    val list = readLine()!!.split(" ").map { it.toInt() }
    var a = 0
    var b = 0
    var c = 0
    var count = 0
    for (i in list.indices) {
        a = list[i]
        for (j in i + 1 until list.size) {
            b = list[j]
            for (k in j + 1 until list.size) {
                c = list[k]
                if (a != b && b != c && c != a) {
                    if (a + b > c && b + c > a && c + a > b) {
                        count++
                    }
                }
            }
        }
    }
    println(count)
}