How many 3×3 matrices M with entries from {0,1,2} are there, for which the sum of the diagonal entries of MTM is 5?