import kotlin.math.*
import java.util.*
import java.io.*
var ans:Int = 0
fun main() {
    val N:Int = readLine()!!.toInt()
    val L = readLine()!!.split(" ").map { it.toLong() }.sorted()
    for(i in 0..N-3){
        for(j in i+1..N-2){
            for(k in j+1..N-1){
                if(L[i]<L[j] && L[j]<L[k]){
                    if(L[k] < L[i]+L[j]){
                        ans++
                    }
                }
            }
        }
    }
    println(ans)
}