N = gets.chomp.to_i
L_ARR = gets.chomp.split(" ").map{|s| s.to_i }.sort

count = 0
N.times do |i|
  a = L_ARR[i]
  (N-i-1).times do |j|
    b = L_ARR[j+i+1]
    max_length = a + b
    (N-i-j-2).times do |k|
      c = L_ARR[i+j+k+2]
      break if c >= max_length
      count += 1
    end
  end
end

puts count