class MakingTriangle
  def initialize(n, al)
    @n = n
    @al = al
  end

  def solve
    ans = 0
    
    (0 .. @n-3).each do |i|
      (i+1 .. @n-2).each do |j|
        (j+1 .. @n-1).each do |k|
          if @al[i] < @al[j] && @al[j] < @al[k] && @al[i] + @al[j] > @al[k]
            ans += 1
          end
        end
      end
    end
    
    ans
  end
end

def run
  n = gets.chomp.to_i
  al = gets.split(/\s+/).map(&:to_i)
  al.sort!

  puts MakingTriangle.new(n, al).solve
end

run
