n = gets.to_i
ls = gets.split.map &:to_i

ls.sort!

count = 0

(0...ls.size).to_a.combination(3).each{ |x|
	if
		ls[x[0]] != ls[x[1]] &&
		ls[x[1]] != ls[x[2]] &&
		ls[x[0]] + ls[x[1]] > ls[x[2]]
	then
		count += 1
	end
}

puts count
