let n = stdin.ReadLine() |> int

let ary =
    stdin.ReadLine().Split()
    |> Array.map uint
    |> Array.sort

let ans =
    match n with
    | x when x < 3 -> 0
    | _ ->
        seq {
            for i in 0 .. (n - 3) do
                for j in (i + 1) .. (n - 2) do
                    for k in (j + 1) .. (n - 1) -> ary.[i], ary.[j], ary.[k]
        }
        |> Seq.filter (fun (lenI, lenJ, lenK) ->
            ((lenI < lenJ) && (lenJ < lenK))
            && (lenI + lenJ > lenK))
        |> Seq.length

printfn "%d" ans
