let n = stdin.ReadLine() |>  int
let l = stdin.ReadLine().Split() |> Array.map int
let mutable sd = Array.sort l
let mutable count = 0L

for i in 2..(n-1) do
 for j in 1..(i-1) do
  count <- count + ([for k in 0..(j-1) do yield (if sd.[k] + sd.[j] > sd.[i] then 1L else 0L)] |> List.sum)
 
count
|>stdout.WriteLine