import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val l = (1..n).map { sc.nextInt() }


  var count = 0

  for (i in 0 until n) {
    for (j in i+1 until n) {
      for (k in j+1 until n) {
        
        if (l[i] == l[j] || l[j] == l[k] || l[k] == l[i]) continue

        if (isT(l[i], l[j], l[k])) {
          count++
        }
      }
    }
  }

  println(count)

}


private fun isT(a: Int, b: Int, c: Int): Boolean {
  if (a + b > c && b + c > a && c + a > b) return true

  return false
}