G := SymmetricGroup(4); S := 0; for pi in G do for rho in G do if pi*rho eq rho*pi then S := S+1; end if; end for; end for; S; S/(#G)^2;