n = gets.to_i
l = gets.split(" ").map(&:to_i)
l = l.combination(3).to_a
i = 0
sum = 0

while i < l.length do
  m = l[i]
  if m[0] != m[1] && m[1] != m[2] && m[0] != m[2] && m[0] < m[1] + m[2] && m[1] < m[0] + m[2] && m[2] < m[0] + m[1]
    sum += 1
  end
  i += 1
end

puts sum
