require 'set'

n = gets.to_i
l = gets.split.map(&:to_i)

len = l.length
count = 0

result_set = Set.new

(0..len-3).each do |i|
  (i+1..len-2).each do |j|
    next if l[i] == l[j]
    (j+1..len-1).each do |k|
      next if l[j] == l[k] || l[i] == l[k]
      next unless (l[i] + l[j] > l[k]) && (l[j] + l[k] > l[i]) && (l[k] + l[i] > l[j])
      result = [l[i], l[j], l[k]]
      count += 1
    end
  end
end

puts count
