sticks_length = gets.chomp.to_i
sticks = gets.chomp.split.map(&:to_i)

sticks_asc = sticks.sort_by{ |stick| stick }

result = 0
# 1辺目固定用 一番長いのから選ぶ stick1 = sticks_asc[i]
(sticks_length - 1).downto(2) do |i|

  # 2辺目固定用 stick2 = sticks[j]
  (i - 1).downto(1) do |j|

    # 2辺が固定されたのであと1本の必要な長さがわかる
    min_length = sticks_asc[i] - sticks_asc[j]
    # 短すぎる枝の数
    small_stick_num = 0
    0.upto(j - 1) do |k|
      break if  min_length < sticks_asc[k]
      small_stick_num += 1
    end
    result += j - small_stick_num
  end
end

puts result