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

cnt = 0
hash = {}
(0..n-1).to_a.combination(3).each do |aa|
	a = arr[aa[0]]; b = arr[aa[1]]; c = arr[aa[2]]
	next if [a, b, c].uniq.length < 3
	cnt += 1 if a + b > c && b + c > a && c + a > b 
end
puts cnt