
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  sc.useDelimiter("\n")
  val N = sc.nextInt()
  val L = sc.next().split(' ').map(_.toInt).toList
  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)
}