func main() {
    var n = Int(readLine()!)!
    if n < 3 {
        print(0)
        return
    }
    let lList = readLine()!.split(separator: " ").map{Int($0)!}
    var lDict = Dictionary<Int, Int>()
    for l in lList {
        if lDict[l] != nil {
            lDict[l]! += 1
        } else {
            lDict[l] = 1
        }
    }
    let lSet = Set(lList)
    let newlList = Array(lSet).sorted()
    var count = 0
    n = newlList.count
    for i in 1...n-2 {
        for j in i+1...n-1 {
            for k in j+1...n {
                if newlList[k-1] < newlList[j-1] + newlList[i-1] {
                    count += lDict[newlList[k-1]]! * lDict[newlList[j-1]]! * lDict[newlList[i-1]]!
                }
            }
        }
    }
    print(count)
}

main()
