import Foundation

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

func readString() -> String {
    return readLine()!
}

func readLines(times: Int) -> [String] {
    var array = [String]()
    for _ in 0..<times {
        array.append(readLine()!)
    }
    return array
}

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

func readStringToStrings() -> [String] {
    return readLine()!.map{String($0)}
}

func readSeparatedInts() -> [Int] {
    return readLine()!.split(separator: " ").map {Int($0)!}
}
func readSeparatedDouble() -> [Double] {
    return readLine()!.split(separator: " ").map {Double($0)!}
}

// 二進数に変換
func convertIntToRadix2(n: Int, radix: Int = 2) -> String {
    return String(n, radix: radix)
}

//配列を逆順にする reverced ソートする　sorted

let N = readInt()
let sticks = readSeparatedInts().sorted()

var result = 0

for i in 0..<N {
    for j in 1..<N {
        for k in 2..<N {
            if (i < j) && (j < k) {
                let a = sticks[i]
                let b = sticks[j]
                let c = sticks[k]
                
                if !((a == b) || (b == c) || (c == a)) {
                    if a + b > c {
                        result += 1
                    }
                }
            }
        }
    }
}
print(result)

