let () = Scanf.scanf "%d\n" @@ fun n ->
  let ls = Array.init n @@ fun _ -> Scanf.scanf "%d " Fun.id in
  Printf.printf "%d\n" @@
  List.fold_left (List.fold_left (List.fold_left ( + ))) 0 @@
  List.init n @@ fun i ->
    List.init i @@ fun j ->
      List.init j @@ fun k ->
        if
          ls.(i) <> ls.(j) &&
          ls.(j) <> ls.(k) &&
          ls.(k) <> ls.(i) &&
          ls.(i) + ls.(j) > ls.(k) &&
          ls.(j) + ls.(k) > ls.(i) &&
          ls.(k) + ls.(i) > ls.(j)
        then 1
        else 0

