n = gets.chomp.to_i
l = gets.chomp.split(' ').map(&:to_i).sort

sum = 0

prev = 0
pv = [0,0,0]

for cv in l.combination(3) do
  if (pv != cv) and (cv[0] < cv[1]+cv[2]) and (cv[1] < cv[0]+cv[2]) and (cv[2] < cv[0]+cv[1]) then
    prev = 1
    pv = cv
  else
    prev = 0
  end
  sum += prev
end
print sum
