let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let arr = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let _ = Array.fast_sort compare arr in
  let ans = ref 0 in
  for i = 0 to Array.length arr - 1 do
    for j = i + 1 to Array.length arr - 1 do
      for k = j + 1 to Array.length arr - 1 do
        if arr.(i) <> arr.(j) && arr.(j) <> arr.(k) && arr.(i) + arr.(j) > arr.(k) 
        then ans := !ans + 1
      done;
    done;
  done; Printf.printf "%d\n" !ans