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

answer = 0
(0...n).each do |i|
  ((i + 1)...n).each do |j|
    ((j + 1)...n).each do |k|
      a = [l[i], l[j], l[k]].sort
      answer += 1if a[0] != a[1] && a[1] != a[2] && a[0] + a[1] > a[2]
    end
  end
end
puts answer