import io.StdIn.{readInt, readLine}
object Main extends App {
  val n = readInt
  val ls = readLine.split(" ").map(_.toInt)

  def different(i1: Int, i2: Int, i3: Int): Boolean = i1 != i2 && i2 != i3 && i3 != i1
  def makeable(i1: Int, i2: Int, i3: Int): Boolean = {
    val sorted = Seq(i1, i2, i3).sorted
    sorted(2) < sorted(0) + sorted(1)
  }

  val count = for (i <- 0 until n-2; j <- i until n-1; k <- j until n) yield {
    val li = ls(i)
    val lj = ls(j)
    val lk = ls(k)
    if (different(li, lj, lk) && makeable(li, lj, lk)) 1
    else 0
  }

  val result = count.sum
  println(result)
}
