let rec combos<'a> (lst: 'a list) k : 'a list list =
    let impl () =
        let head = [lst.Head]
        let subcombos = combos lst.Tail (k - 1)
        let ret = subcombos |> List.map (fun x -> head @ x)
        ret @ (combos lst.Tail k)
    if k = 0 then [[]]
    elif lst.IsEmpty then []
    else impl ()

let f lst =
    let cond a b c = 
        a < b + c && b < c + a && c < a + b
    combos 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 |> Array.toList
let ans = f lst

printfn "%d" ans