object Main {
  def main(args: Array[String]): Unit = {
    val nums    = scala.io.StdIn.readInt
    val lengths = scala.io.StdIn.readLine.split( " " ).map{ _.toLong }.sorted
    var check_length = Array.empty[ Long ]
    var count = 0

    ( 0 until nums ).foreach{ i =>
      ( i + 1 until nums ).foreach{ j =>
        ( j + 1 until nums ).foreach{ k =>
          if( lengths( k ) < lengths( i ) + lengths( j ) &&
              lengths( j ) != lengths( k ) &&
              lengths( i ) != lengths( j )
            ) {
              count += 1
            }
        }
      }
    }
    println( count )
  }
}