Let $M$ be any $3 \times 3$ matrix with entries from the set $0, 1, 2$. The maximum number of such matrices, for which the sum of diagonal elements of $M^T M$ is seven, is ______.
Numerical-value question: the answer is a number.
Show answer
The answer is 540.
Key from source paper