fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main() {
    val n = readLine()?.toInt() ?: return
    val l = longList()
    var c = 0
    0.until(n).forEach { ii ->
        val i = l[ii]
        (ii + 1).until(n).forEach { jj ->
            val j = l[jj]
            (jj + 1).until(n).forEach { kk ->
                val k = l[kk]
                if (i + j > k && j + k > i && k + i > j && i != j && j != k && k != i) {
                    c++
                }
            }
        }
    }
    println(c.toString())
}
