n = gets.to_i
l = gets.split(" ").map(&:to_i)
ans = 0

(0...n).each do |x|
  (x+1...n).each do |y|
    (y+1...n).each do |z|
      array = [l[x],l[y],l[z]]
      array = array.sort
        if array[0] + array[1] > array[2] && \
           array[0] != array[1] && array[1] != array[2] && array[2] != array[0]
          ans += 1
        end
    end
  end
end

puts ans