class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n = gets.to_s.to_i
    @a = gets.split.map(&:to_i)
  end

  def solve
    ans = 0
    0.upto(n-3) do |i|
      (i+1).upto(n-2) do |j|
        (j+1).upto(n-1) do |k|
          ans += 1 if query(i,j,k)
        end
      end
    end
    ans
  end

  def query(i,j,k)
    a[i] < a[j] + a[k] &&
    a[j] < a[i] + a[k] &&
    a[k] < a[j] + a[i] &&
    a[i] != a[j] &&
    a[i] != a[k] &&
    a[k] != a[j]
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end