import Foundation
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

func check(_ a: Int, _ b: Int, _ c: Int) -> Bool {
  if a != b , b != c , a != c {
    if a + b > c , b + c > a , c + a > b {
      return true
    }
  }
  return false
}
let n = Int(readLine()!)!
let li = readInts()
guard li.count != 1 else { print(0); exit(0) }
var ans = 0
for i in 0..<n-2 {
  for j in i+1..<n-1 {
    for k in j+1..<n {
      if check(li[i], li[j], li[k]) {
        ans += 1
      }
    }
  }
}
print(ans)