import java.util.Arrays;
import java.util.Scanner;

fun main (args : Array<String>) {
  val input = Scanner(System.`in`)
  
  while (input.hasNext()) {
    val N = input.nextInt()
    val L = IntArray(N)
    
    for (i in L.indices) {
      L[i] = input.nextInt()
    }
    
    Arrays.sort(L)
    
    var count = 0
    for (i in 0..L.lastIndex) {
      for (j in (i + 1)..L.lastIndex) {
        for (k in (j + 1)..L.lastIndex) {
          if (L[i] != L[j] && L[j] != L[k]) {
            if (L[i] + L[j] > L[k] && L[j] - L[i] < L[k]) {
              ++count
            }
          }
        }
      }
    }
    
    println(count)
  }
}