local n = io.read("*n")
local t = {}
for i = 1, n do
  table.insert(t, io.read("*n"))
end
local ans = 0
for i = 1, #t-2 do
  for j = i+1, #t-1 do
    for k = j+1, #t do
      local a, b, c = t[i], t[j], t[k]
      if a<b+c and b<c+a and c<a+b then
        ans = ans + 1
      end
    end
  end
end
print(ans)