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

0.upto(n - 3) do |i|
  (i + 1).upto(n - 2) do |j|
    (j + 1).upto(n - 1) do |k|
      if l[i] != l[j] && l[j] != l[k] && l[k] != l[i] && l[i] + l[j] > l[k] && l[j] + l[k] > l[i] && l[i] + l[k] > l[j]
        count += 1
      end
    end
  end
end

puts count