open Printf
open Scanf

let id x = x

let solve n =
  let al = Array.init n @@ fun _ -> scanf "%d " id in
  let ans = ref 0 in
  Array.sort compare al;
  for i = 0 to n-3 do
    for j = i+1 to n-2 do
      for k = j+1 to n-1 do
        if al.(i) < al.(j) && al.(j) < al.(k) && al.(i) + al.(j) > al.(k) then incr ans
      done
    done
  done;
  !ans
  
let () =
  scanf "%d " solve |> printf "%d\n"
