fun main(args: Array<String>) {

    val n = readLine()!!.toInt()
    val ls = readLine()!!.split(" ").map { it.toInt() }


    /*
    val n = 5
    val ls = listOf(4, 4, 9, 7, 5)
    */

    var answer = 0

    (0 until n).forEach { i ->
        (i + 1 until n).forEach { j ->
            (j + 1 until n).forEach { k ->
                //println("i $i, j: $j, k: $k")
                val a = ls[i]
                val b = ls[j]
                val c = ls[k]

                if (!(a == b || a == c || b == c) && isTriangle(a, b, c)) {
                    //println("ok: $a $b $c")
                    answer++
                }
            }
        }
    }

    println("$answer")
}

fun isTriangle(a: Int, b: Int, c: Int): Boolean {
    return a + b > c && b + c > a && c + a > b
}
