Solution
= Solution
Let $\chi_{\rm reg}$ be the character of the <regular representation>. It has $\chi_{\rm reg}(1)=|G|$ and vanishes away from the identity. The multiplicity of an irreducible character $\chi_j$ in it is
$$
\langle\chi_{\rm reg},\chi_j\rangle
=\frac1{|G|}|G|\chi_j(1)=n_j.
$$
Thus the regular representation decomposes as $\bigoplus_j n_j\rho_j$. Comparing dimensions gives
$$
\boxed{|G|=\sum_{j=1}^k n_j^2.}
$$