N = gets.chomp.to_i
L = gets.chomp.split.map(&:to_i)
count = 0

(0...N).each do |i|
  (i+1...N).each do |j|
    (j+1...N).each do |k|
      list = []
      list.push(L[i], L[j], L[k])
      list.sort!
      if list[0] != list[1] && list[1] != list[2] && list[2] != list[0]
        if (list[0] + list[1]) > list[2] 
          count += 1
        end
      end
    end
  end
end

puts count