N = gets.chomp.to_i
inputs = gets.chomp.split(" ")
count = 0
inputs.each_with_index do |e,i|
  inputs2=inputs.dup
  inputs2.shift(i+1)
  e = e.to_i
  inputs2.each_with_index do |f,j|
    f=f.to_i
    inputs3 = inputs2.dup
    inputs3.shift(j+1)
    inputs3.each do |g|
      g = g.to_i
      if (e + g > f)&&(f + g > e)&&(e + f > g)
        count +=1
      end
    end
  end
end
 
puts count
