n = gets.chomp.to_i
l_arr = gets.chomp.split(" ").map(&:to_i)

count = 0
(0..n-3).each do |i|
  (i+1..n-2).each do |j|
    (j+1..n-1).each do |k|
      l1 = l_arr[i]
      l2 = l_arr[j]
      l3 = l_arr[k]
      count += 1 if l1 != l2 && l2 != l3 && l3 != l1 && l1 < l2 + l3 && l2 < l3 + l1 && l3 < l1 + l2
    end
  end
end

puts count