n = gets.to_i
l = gets.chomp.split(" ").map(&:to_i)
cnt = 0
l.combination(3).each do |s|
  if s[0] != s[1] && s[1] != s[2] && s[2] != s[0]
    cnt += 1 if s[0]+s[1] > s[2] && s[1]+s[2] > s[0] && s[2]+s[0] > s[1]
  end
end
puts cnt