let combos2 n k =
    let rec choose lo  =
        function
        |0 -> [[]]
        |i -> [for j=lo to (Array.length n)-1 do
               for ks in choose (j+1) (i-1) do
               yield n.[j] :: ks ]
    in choose 0  k  

let f lst =
    let cond a b c = 
        a < b + c && b < c + a && c < a + b
    combos2 lst 3
    |> List.filter (fun xs -> cond xs.[0] xs.[1] xs.[2])
    |> List.length

stdin.ReadLine() |> ignore
let lst = stdin.ReadLine().Split() |> Array.map int
let ans = f lst

printfn "%d" ans