n = ARGF.gets
l = ARGF.gets.split.map(&:to_i).sort

num = 0
(2 .. l.size-1).each do |i|
  half = l[i]/2
  j1 = l[0...i].bsearch_index {|x| x > half}
  (j1 .. i-1).each do |j|
    diff = l[i] - l[j]
    k = l[0...j].bsearch_index {|x| x > diff}
    $stderr.puts "i,j=#{l[i]},#{l[j]}, diff=#{diff}, l=#{l[0...j]} k=#{k}"
    num += j-k unless k == nil
  end
end

puts num
