import scala.io.StdIn._

object Main extends App {

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

  def solve() = {
    (0 until n).combinations(3).foldLeft(0) { (acc, combi) =>
      val list = for(i <- combi) yield L(i)
      val max = list.max
      val others = list.sum - max
      if(others > max && list(0) != list(1) && list(1) != list(2) && list(0) != list(2)) acc+1 else acc
    }
  }

  println(solve())

}

