If n(A) = n then n{(x,y,z);x,y,z∈Ax≠y,y≠z,z≠x}=
n3
n(n – 1)2
n2 (n – 2)
n3 – 3n2 + 2n
There are n choices for the first coordinate, n – 1 choices for second coordinate and n – 2 choices for the third coordinate, hence
n({(x,y,z);x,y,z∈A,x≠y≠z})=n(n−1)(n−2)=n3−3n2+2n