import Foundation
let n = Int(readLine()!)!
if n < 3 {
  print(0)
  exit(0)
}
let l = readLine()!.split(separator: " ").map { Int($0)! }

var count = 0
for a in 0..<n-2 {
  for b in a+1..<n-1 {
    for c in b+1..<n {
      if l[a] != l[b] && l[b] != l[c] && l[a] != l[c] && l[a] + l[b] > l[c] && l[b] + l[c] > l[a] && l[c] + l[a] > l[b] {
        count += 1
      }
    }
  }
}
print(count)