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

cnt = 0
L.combination(3).to_a.each do |edges|
  e1 = edges[0] < edges[1] + edges[2]
  e2 = edges[1] < edges[0] + edges[2]
  e3 = edges[2] < edges[0] + edges[1]
  eq = edges.uniq.length == 3

  cnt += 1 if e1 && e2 && e3 && eq
end

puts cnt
