import Foundation

main()

func main(){
    let _ = readLine()
    let vals = readLine()!.components(separatedBy:" ").map{(v) -> Int in return Int(v)!}
    var count = 0
    for i in vals.indices {
        for j in i+1 ..< vals.count {
            for k in j+1 ..< vals.count {
                if (isValidTriangle(vals[i],vals[j],vals[k])) {
                    count+=1
                }
            }
        }
    }
    print(count)
}

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

