func readInt() -> Int {
    return Int(readLine()!)!
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func mainB() {
    let N = readInt()
    let lines = readInts()

    var answers = Set<Set<Int>>()
    for (aIndex, a) in lines.enumerated() {
        for (bIndex, b) in lines.enumerated() {
            for (cIndex, c) in lines.enumerated() {
                if aIndex == bIndex || bIndex == cIndex || cIndex == aIndex { continue }
                if a == b || b == c || c == a { continue }

                if a + b > c, b + c > a, a + c > b {
                    answers.insert(Set(arrayLiteral: aIndex, bIndex, cIndex))
                }
            }
        }
    }

    print(answers.count)
}
mainB()