open System

let N = Console.ReadLine() |> int
let L = Console.ReadLine().Split() |> Array.map int

let isTriangle x y z = x + y > z

let sortL = L |> Array.sort
              |> Array.distinct
let len = sortL |> Array.length

let mutable ret = 0

for a in [0 .. len - 3] do
    for b in [a + 1 .. len - 2] do
        let mutable c = b + 1
        let rec loop (a, b, c) =
            if c < len && isTriangle sortL.[a] sortL.[b] sortL.[c] then
                ret <- ret + 1
                loop(a, b, c + 1)
        loop(a, b, c)

printfn "%A" ret