n = gets.to_i
l = gets.split.map(&:to_i).sort
cnt = 0
n.times do |i|
  i.next.upto(n.pred) do |j|
    m = l[i] + l[j]
    j.next.upto(n.pred) do |k|
      break if m <= l[k]
      cnt += 1
    end
  end
end
puts cnt