let () = Scanf.scanf "%d" @@ fun n ->
  let ls = Array.init n @@ Scanf.scanf " %d" Fun.id in
  let ans = 
    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.(i) <> ls.(k) &&
              ls.(j) <> ls.(k) &&
              ls.(i) + ls.(j) > ls.(k) &&
              ls.(i) + ls.(k) > ls.(j) &&
              ls.(j) + ls.(k) > ls.(i)
            then 1 else 0
  in
  Printf.printf "%d\n" ans