
import java.util.*
fun main(args: Array<String>) {
    val reader = Scanner(System.`in`)
    val N = reader.nextInt()
    val numList = mutableListOf<Int>()
    repeat(N){
        numList.add(reader.nextInt())
    }
    val stateList = mutableListOf<MutableList<Int>>()
    var count = 0
    repeat(N){
        val size = stateList.size
        val currentNum = numList[it]
        
        stateList.add(mutableListOf(currentNum))
        for (i in 0 until size) {
            val oldItems = stateList[i]
            val newItems = mutableListOf<Int>()
            newItems.addAll(oldItems)
            
            var findFlg = false
            for(j in 0 until newItems.size){
                findFlg =  currentNum == newItems[j]
                if(findFlg){
                    break
                }
            }
            if (!findFlg) {
                newItems.add(currentNum)
                if (newItems.size < 3) {
                    stateList.add(newItems)
                } else {
                    if (newItems[0] + newItems[1] > newItems[2] &&
                        newItems[0] + newItems[2] > newItems[1] &&
                        newItems[1] + newItems[2] > newItems[0]
                    ) {
                        count++
                    }

                }
            }
        }
    }
    println(count)
}