n = gets.to_i
l = gets.split.map(&:to_i).sort
count = 0
for i in 0..(n - 3) do
  for j in (i + 1)..(n - 2) do
    for k in (j + 1)..(n - 1) do
      if l[i] < l[j] && l[j] < l[k] && l[i] + l[j] > l[k]
        count += 1
      end
    end
  end
end
puts count
