n = gets.to_i
l = gets.split.map!{|i| i.to_i}
a = 0
count = 0
while a < n - 2 do
  b = a + 1
  while b < n - 1 do
    c = b + 1
    while c < n do
      count += 1 if l[a] < l[b] + l[c] && l[b] < l[c] + l[a] && l[c] < l[a    ] + l[b]
      c += 1
    end
    b += 1
  end
  a += 1
end
puts count
