import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val N = sc.nextInt
  val L = Array.fill(N)(sc.nextInt)

  val z = L.zipWithIndex.combinations(3).filter(x => {
    val Array(a, b, c) = x.map(_._1)

    a != b && a != c && b != c && a + b > c && b + c > a && c + a > b
  }).map(_.map(_._2 + 1)).size

  println(z)
}
