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

num = 0
n.times do |i|
  a = lines[i]
  for j in i+1...n do
    b = lines[j]
    upper_index = lines.find_index{ |k| k >= a + b }
    num = upper_index.nil? ? num + lines.size - 1 - j : num + upper_index - 1 - j
  end
end
 
print num
