import java.util.*
 
fun main(args : Array<String>) {
    val scanner = Scanner(System.`in`)
    val N = scanner.nextLine().toInt()
    var temp = scanner.nextLine().split(" ")
    val arr = IntArray(temp.size) { temp[it].toInt() } 
    var count = 0
    for(i in 0 until arr.size - 2) {
      for(j in i + 1 until arr.size - 1) {
        for(k in j + 1 until arr.size) {
           if(arr[i] != arr[j] && arr[j] != arr[k] && arr[k] != arr[i]) {
              val temp = intArrayOf(arr[i], arr[j], arr[k])
              val max = temp.max()!!
              if(temp.sum() - max > max) count++ 
           }
        }
      }
    }
    
    // 4 4 5 7 9
    println(count)
}