n = gets.to_i
l = gets.chomp.split(" ").map(&:to_i).sort {|a, b| b <=> a }

results = 0
a = 0
while a < n
	b = a + 1
	while b < n
		s = b + 1
		e = n - 1
		flag = false
		while s <= e
			c = (s + e) / 2
			if l[c] > l[a] - l[b] then
				flag = true
				s = c + 1
			else
				e = c - 1
			end
		end
		if flag then
			results = results + c - b
		end
		b = b + 1
	end
	a = a + 1
end
print results