fun main() {
    val N = readLine()!!.toInt()
    val input = readLine()!!.split(" ").map { it.toInt() }
    val L = input.toMutableList()
    L.add(0, 0)
    var cnt = 0

    for (i in 1..N-2) {
        for (j in i+1..N-1) {
            for (k in j+1..N) {
                val list = mutableListOf<Int>(L[i], L[j], L[k])
                list.sortDescending()
                val set = list.toSet()
                if (list[0] < list[1] + list[2] && set.size == 3) {
                    cnt ++
                }
            }
        }
    }

    println(cnt)
}