N = gets.to_i
Ls = gets.split.map(&:to_i)

ls = Ls.sort.reverse
ans = 0
(0 ... N - 2).each do |i|
  (i + 1 ... N - 1).each do |j|
    ans += [*(j + 1) ... N].bsearch_index{|k| ls[k] <= ls[i] - ls[j]} || N - j - 1
  end
end
puts ans