let n:Int = Int(readLine()!)!
let l:[Int] = readLine()!.split(separator:" ").map{Int($0)!}
var count:Int = 0
for i in 0..<n-2 { for j in i+1..<n-1 { for k in j+1..<n {
  let a = l[i], b = l[j], c = l[k]
  if a+b<=c || b+c<=a || c+a<=b || a==b || b==c || c==a {}
  else {count+=1}
}}}
print(count)