We consider the following sets
\( A =\{ (x,y,z) : 0<x<y<z\ \text{ and }\ x+y+z=n\} \)
and
\( B =\{ (x,y,z) : 0<x,y,z\ \text{ and }\ x\neq y\neq z\neq x\ \text{ and }\ x+y+z=n\}. \)
There is a relation between cardinals of both sets, which is
\( |B| = 3!\;|A|. \)
So we reduce the problem to count the number of element of set \( B \). In order to calculate the cardinal of \( B \), we decompose the set as
\( B = C \setminus (C_{12}\cup C_{13}\cup C_{23}\cup C_{123}), \)
where
\( C = \{ (x,y,z) : 0<x,y,z\ \text{ and }\ x+y+z=n\}, \)
\( C_{12} = \{ (x,y,z) : 0<x,y,z\ \text{ and }\ x=y\neq z\ \text{ and }\ x+y+z=n\}, \)
\( C_{13} = \{ (x,y,z) : 0<x,y,z\ \text{ and }\ x=z\neq y\ \text{ and }\ x+y+z=n\}, \)
\( C_{23} = \{ (x,y,z) : 0<x,y,z\ \text{ and }\ y=z\neq x\ \text{ and }\ x+y+z=n\}, \)
and
\( C_{123} = \{ (x,y,z) : 0<x=y=z\ \text{ and }\ x+y+z=n\}. \)
We note that \( C_{12},C_{13},C_{23},C_{123}\subset C \) and the sets \( C_{12},C_{13},C_{23},C_{123} \) are pairwise disjoint sets.
It turns out that \( |B| = |C| - |C_{12}| - |C_{13}| - |C_{23}| - |C_{123}| \).
We have to count the cardinal of \( B, C_{12},C_{13},C_{23} \) and \( C_{123} \).
It is easy (if not you can ask) to see that \( |C| = \binom{n-1}{2} \),
\( |C_{12}| = |C_{13}| = |C_{23}| = \left\{\begin{array}{ll} k-1 & \text{ if } n\equiv 0 \pmod{2},\\ k & \text{ if } n\not\equiv 0 \pmod{2},\\\end{array}\right. \)
and
\( |C_{123}| = \left\{\begin{array}{ll} 1 & \text{ if } n\equiv 0 \pmod{3},\\0 & \text{ if } n\not\equiv 0 \pmod{3},\\\end{array}\right. \)
where \( n = 2k + r \) with \( r=0,1 \).
Please, check my arguments in case I made a mistake.
NOTE: \( |C_{12}| \) is incorrect, see the answer #4.