N=gets.to_i
as=gets.split.map(&:to_i).sort.reverse
cnt=0
for i in 0..N-2
  for j in i+1...N-1
    idx=as.bsearch_index{|e|e<=as[i]-as[j]}
    idx=N if idx.nil?
    cnt+=0<idx-j-1 ? idx-j-1 : 0
  end
end
puts cnt
