n=gets.to_i
a=gets.split.map &:to_i
ans=0
(0...n).each do |i|
	(i+1...n).each do |j|
		(j+1...n).each do |k|
			x,y,z=[a[i],a[j],a[k]].sort
			if x!=y&&y!=z&&x+y>z
				ans+=1
			end
		end
	end
end
puts ans