let N = Int(readLine()!)!
if N < 3 {
    print(0)
} else {
    var L: [Int] = readLine()!.split(separator: " ").map { Int($0)! }
    L.sort()
    var cou: Int = 0
    for i in 0..<N-2 {
        for j in i+1..<N-1 {
            for k in j+1..<N {
                if L[i] == L[j] || L[j] == L[k] { continue }
                if L[i] + L[j] > L[k] { cou += 1 }
            }
        }
    }
    print(cou)
}