import java.lang.management.MemoryUsage

fun main(){
    val n = readLine()!!.split(" ")[0].toInt()
    val l = readLine()!!.split(" ").map { it.toInt() }.sorted()
    val ll = mutableListOf<Int>()
    val kaisuu = mutableListOf<Int>()
    ll.add(l[0])
    kaisuu.add(1)
    for (i in 1 until n){
        if (l[i] == l[i-1]){
            val size = ll.size - 1
            kaisuu[size]++
        } else {
            ll.add(l[i])
            kaisuu.add(1)
        }
    }
    val m = ll.size
    var ans = 0
    for (i in 0 until m){
        for (j in i+1 until m){
            val total = ll[i] + ll[j]
            for (k in j+1 until m){
                if (total > ll[k]) {
                    ans += kaisuu[i] * kaisuu[j] * kaisuu[k]
                }
            }
        }
    }
    println(ans)
}