fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val ll = readLine()!!.split(" ").map { it.toInt() }.sorted()

    var cnt = 0

    for (i in 0 until n-2) {
        inner1@for (j in i+1 until n-1) {
            if (ll[i] == ll[j]) continue@inner1

            inner2@for (k in j+1 until n) {
                if (ll[j] == ll[k]) continue@inner2
                if (ll[k] >= ll[i] + ll[j]) continue@inner2

                cnt++
            }
        }
    }

    println(cnt)
}