object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val l = Array.fill(n)(sc.nextLong())
  var ans = 0
  for {
    i <- 0 until n-2
    j <- i+1 until n-1
    k <- j+1 until n
  } {
    val max = l(i).max(l(j)).max(l(k))
    if (l(i) != l(j) && l(i) != l(k) && l(j) != l(k) &&
      max < l(i) + l(j) + l(k) - max
    ) {
      ans += 1
    }
  }
  println(ans)
}
