Problem 24.

This was done manually. It's a simple permutations problem.