import Foundation

func main() {
    guard let line = readLine() , let line2 = readLine() else { return }
    let n = Int(line)!
    let l = line2.components(separatedBy: " ").compactMap() { Int($0) }
    guard n < 3 else {
        print(0)
        return
    }
    var count = 0
    for i in 0..<(n-2) {
        for j in (i+1)..<(n-1) {
            for k in (j+1)..<n {
                if check(j: l[i], k: l[j], l: l[k]) {
                    count += 1
                }
            }
        }
    }
    print(count)
}

func check(j: Int, k: Int, l: Int) -> Bool {
    return mul(a: j, b: k, c: l) && mul(a: k, b: l, c: j) && mul(a: l, b: j, c: k)
}

func mul(a: Int, b: Int, c: Int) -> Bool {
    return a + b > c && a != b
}

main()
