fun main() {
    val n = readLine()!!.trim().toInt()
    val bars = readLine()!!.trim().split(' ').map(String::toInt).sorted()
    var sum = 0
    for (i in bars.indices) {
        for (j in 0 until i) {
            if (bars[i] == bars[j]) break
            if (bars[i] >= bars[j] shl 1) continue
            for (k in 0 until j) {
                if (bars[j] == bars[k]) break
                if (bars[i] >= bars[j] + bars[k]) continue
                ++sum
            }
        }
    }
    println(sum)
}