import kotlin.math.pow

fun main() {
    readLine()
    val list = readLine()!!.split(" ").map(String::toInt).sorted()
    list.indices.flatMap { i ->
        (i + 1 until list.size).flatMap { j ->
            (j + 1 until list.size).map { k ->
                Triple(list[i], list[j], list[k])
            }
        }
    }.filter {
        it.toList().distinct().size == 3
    }.filter {
        it.first + it.second > it.third
    }.count().let {
        println(it)
    }
}
