import java.io.PrintWriter
import java.util.StringTokenizer

fun main() {

    fun PrintWriter.solve() {
        val n = nextInt()
        val L = List(n){nextInt()}

        var ans = 0
        for (i in L.indices){
            for (j in i+1..n-1){
                for (k in j+1..n-1){
                    if (L[i] == L[j] || L[j] == L[k] || L[i] == L[k]) continue
                    val list = listOf(L[i],L[j], L[k]).sorted()
                    if (list[0] + list[1] > list[2])ans++
                }
            }
        }

        println(ans)

    }

    writer.solve()
    writer.flush()


}


private val reader = System.`in`.bufferedReader()
private val writer = PrintWriter(System.out, false)

private var tokenizer: StringTokenizer = StringTokenizer("")

private fun next(): String {
    while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(reader.readLine())
    return tokenizer.nextToken()
}

private fun nextInt() = next().toInt()
private fun nextLong() = next().toLong()
private fun nextDouble() = next().toDouble()
private fun nextLine() = reader.readLine()

