struct Scanner {
    private var elements = [String]()
    private var index = 0

    mutating func peek() -> String {
        while elements.count == index {
            elements = readLine()!.split(separator: " ").map(String.init)
            index = 0
        }
        return elements[index]
    }

    mutating func next() -> String {
        let value = peek()
        index += 1
        return value
    }

    mutating func nextInt() -> Int {
        return Int(next())!
    }

    mutating func nextDouble() -> Double {
        return Double(next())!
    }
}

var scanner = Scanner()
let N = scanner.nextInt()
let L = (0 ..< N).map { _ in scanner.nextInt() }.sorted()

var answer = 0
for i in 0 ..< N {
    for j in i + 1 ..< N {
        for k in j + 1 ..< N {
            guard L[i] != L[j] && L[i] != L[k] && L[j] != L[k] else { continue }
            if L[i] + L[j] > L[k] {
                answer += 1
            }
        }
    }
}
print(answer)
