import scala.io.StdIn._

object Main extends App {

  val n = readInt()
  val L = readLine().split(" ").map(_.toInt)

  def solve() = {
    var ans = 0
    for {
      i <- 0 until n
      j <- i until n
      k <- j until n
    } {
      val list = Seq(L(i), L(j), L(k))
      val max = list.max
      val isTriangle = max < list.sum - max
      val isUnique = list.toSet.size == 3
      if(isTriangle && isUnique) ans += 1
    }
    ans
  }

  println(solve())

}

