import java.util.Scanner

fun main() {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	val l = IntArray(n){scn.nextInt()}.also { it.sort() }
	var cnt = 0
	for (i in l.indices){
		val li = l[i]
		for (j in i+1..l.lastIndex){
			val lj = l[j]
			if (li==lj) continue
			for (k in j+1..l.lastIndex){
				val lk = l[k]
				if (li==lk || lj==lk) continue
				if (li+lj>lk) cnt++
			}
		}
	}
	println(cnt)
}
