# 5 n
# 4 4 9 7 5 l

n = gets.to_i
array_l = gets.split.map(&:to_i)

array_n = (0..(n-1)).to_a
conbination = array_n.combination(3).to_a

count = 0
conbination.each do |conb|
  l_1 = array_l[conb[0]]
  l_2 = array_l[conb[1]]
  l_3 = array_l[conb[2]]

  array_tri = [l_1, l_2, l_3]
  array_tri.uniq!
  next if array_tri.length <= 2
  array_tri.sort!

  if array_tri[0] + array_tri[1] > array_tri[2]
    count += 1
  end
end

puts count
