import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var kotlin=scan.nextLine().toInt()
    var arr = scan.nextLine().split(" ").map{ it.trim().toInt() }.toTypedArray()
    var count = 0

    for(i in 0..arr.lastIndex)
    {
        for(j in i+1..arr.lastIndex)
        {
            for(k in j+1..arr.lastIndex)
            {
                var a = arr[i]
                var b = arr[j]
                var c = arr[k]

                if(arr[i]!= arr[j] && arr[j]!=arr[k] && arr[k]!=arr[i])
                {
                   if ((a + b <= c) || (a + c <= b) || (b + c <= a)) {


                   }
                    else
                       count++
                }
            }

        }
    }
    println(count)
}
