gets
lines = gets.split.map(&:to_i).sort.reverse

answer = 0
(0..(lines.size - 3)).each{|long_i|
    ((long_i + 1)..(lines.size - 2)).each{|middle_i|
        tail = lines[(middle_i + 1)..(lines.size - 1)]
        first_invalid_len = tail.bsearch{|short_len| lines[long_i] >= lines[middle_i] + short_len}
        valid_count = tail.size
        if first_invalid_len != nil
            valid_count = tail.find_index(first_invalid_len)
        end
        answer += valid_count
    }
}
puts answer
