n = gets.to_i
l = gets.split.map!{|i| i.to_i}
com = l.combination(3).to_a
com_length = com.length
i = 0
count = 0
while i < com_length do
  count += 1 if com[i][0] < com[i][1] + com[i][2] && com[i][1] < com[i][2]     + com[i][0] && com[i][2] < com[i][0] + com[i][1]
  i += 1
end
puts count