#set
n = gets.chomp.to_i
s = gets.chomp.split(" ").map(&:to_i).sort
count = 0

#main
(0 .. n -3).each do |i|
    (i + 1 .. n - 2).each do |j|
        (j + 1 .. n - 1).each do |k|
            if (s[i] + s[j] ) > s[k] then
                count += 1
            end
        end
    end
end

print ("#{count}\n")