object HelloWorld extends App {
  val N = io.StdIn.readLine().toInt
  val Ls = io.StdIn.readLine().split(" ").map(_.toInt)
  var ans = 0

  for (ai <- Ls.indices){
    for (bi <- ai until Ls.length) {
      for (ci <- bi until Ls.length){
        if ((ai != bi) && (bi != ci) && (ai != ci)) {
          val a = Ls(ai)
          val b = Ls(bi)
          val c = Ls(ci)
          if (a != b && b != c && a != c) {
            if ((a + b > c) && (b + c > a) && (a + c > b)) {
              ans += 1
            }
          }
        }
      }
    }
  }

  println(ans)
}
