  It is known that for the Young diagram of any partition of $n$, the sum of
squares of the hook lengths of its cells is exactly $n^2$ more than that sum of
squares of the contents of its cells. That is, for any $\lambda \vdash n$,
\begin{equation*}
  \sum_{u \in \lambda} h(u)^2 = n^2 + \sum_{u \in \lambda} c(u)^2.
\end{equation*} We provide a bijective proof of this fact, thus solving a
problem posed by Stanley. Along the way, we obtain a formula for the number of
rectangles in the Young diagram of a partition. We also mention a result for
sums of higher powers of hook lengths and contents.
