n = gets.to_i
l = gets.split.map(&:to_i)
l.sort!
ans = 0
(1..n-2).each do |i|
  ((i+1)..n-1).each do |j|
    if l.bsearch_index{|x| x > l[j]-l[i]} != nil && l.bsearch_index{|x| x > l[j]-l[i]} < i
      ans += i - l.bsearch_index{|x| x > l[j]-l[i]}
    end
  end
end
puts ans